Lines Matching refs:ctx

107 static int param_get_bool(void *ctx, const char *key, int def)  in param_get_bool()  argument
110 if ((elem = zend_hash_str_find_ptr(ctx, key, strlen(key))) != NULL) { in param_get_bool()
118 static inline void *accounted_emalloc(size_t alloc_size, ser_context *ctx) in accounted_emalloc() argument
121 zend_llist_add_element(&ctx->allocations, &ret); in accounted_emalloc()
124 static inline void *accounted_ecalloc(size_t nmemb, size_t alloc_size, ser_context *ctx) in accounted_ecalloc() argument
127 zend_llist_add_element(&ctx->allocations, &ret); in accounted_ecalloc()
130 …line void *accounted_safe_ecalloc(size_t nmemb, size_t alloc_size, size_t offset, ser_context *ctx) in accounted_safe_ecalloc() argument
134 zend_llist_add_element(&ctx->allocations, &ret); in accounted_safe_ecalloc()
181 static void do_from_zval_err(ser_context *ctx, const char *fmt, ...) in do_from_zval_err() argument
186 do_from_to_zval_err(&ctx->err, &ctx->keys, "user", fmt, ap); in do_from_zval_err()
190 static void do_to_zval_err(res_context *ctx, const char *fmt, ...) in do_to_zval_err() argument
195 do_from_to_zval_err(&ctx->err, &ctx->keys, "native", fmt, ap); in do_to_zval_err()
216 void (*func)(zval *elem, unsigned i, void **args, ser_context *ctx), in from_array_iterate() argument
218 ser_context *ctx) in from_array_iterate()
231 zend_llist_add_element(&ctx->keys, &bufp); in from_array_iterate()
233 func(elem, i, args, ctx); in from_array_iterate()
235 zend_llist_remove_tail(&ctx->keys); in from_array_iterate()
236 if (ctx->err.has_error) { in from_array_iterate()
249 ser_context *ctx) in from_zval_write_aggregation() argument
255 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_aggregation()
258 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in from_zval_write_aggregation()
263 do_from_zval_err(ctx, "No information on how to convert value " in from_zval_write_aggregation()
268 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in from_zval_write_aggregation()
269 descr->from_zval(elem, ((char*)structure) + descr->field_offset, ctx); in from_zval_write_aggregation()
270 zend_llist_remove_tail(&ctx->keys); in from_zval_write_aggregation()
273 do_from_zval_err(ctx, "The key '%s' is required", descr->name); in from_zval_write_aggregation()
281 res_context *ctx) in to_zval_read_aggregation() argument
288 for (descr = descriptors; descr->name != NULL && !ctx->err.has_error; descr++) { in to_zval_read_aggregation()
292 do_to_zval_err(ctx, "No information on how to convert native " in to_zval_read_aggregation()
300 zend_llist_add_element(&ctx->keys, (void*)&descr->name); in to_zval_read_aggregation()
301 descr->to_zval(structure + descr->field_offset, new_zv, ctx); in to_zval_read_aggregation()
302 zend_llist_remove_tail(&ctx->keys); in to_zval_read_aggregation()
307 static zend_long from_zval_integer_common(const zval *arr_value, ser_context *ctx) in from_zval_integer_common() argument
350 do_from_zval_err(ctx, "expected an integer, but got a non numeric " in from_zval_integer_common()
356 do_from_zval_err(ctx, "%s", "expected an integer, either of a PHP " in from_zval_integer_common()
365 void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_int() argument
370 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_int()
371 if (ctx->err.has_error) { in from_zval_write_int()
376 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_int()
384 static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uint32() argument
389 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uint32()
390 if (ctx->err.has_error) { in from_zval_write_uint32()
395 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uint32()
403 static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_net_uint16() argument
408 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_net_uint16()
409 if (ctx->err.has_error) { in from_zval_write_net_uint16()
414 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_net_uint16()
422 static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_sa_family() argument
427 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_sa_family()
428 if (ctx->err.has_error) { in from_zval_write_sa_family()
433 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_sa_family()
441 static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_pid_t() argument
446 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_pid_t()
447 if (ctx->err.has_error) { in from_zval_write_pid_t()
452 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_pid_t()
460 static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx) in from_zval_write_uid_t() argument
465 lval = from_zval_integer_common(arr_value, ctx); in from_zval_write_uid_t()
466 if (ctx->err.has_error) { in from_zval_write_uid_t()
473 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
479 do_from_zval_err(ctx, "%s", "given PHP integer is out of bounds " in from_zval_write_uid_t()
489 void to_zval_read_int(const char *data, zval *zv, res_context *ctx) in to_zval_read_int() argument
496 static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) in to_zval_read_unsigned() argument
503 static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) in to_zval_read_net_uint16() argument
510 static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) in to_zval_read_uint32() argument
517 static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) in to_zval_read_sa_family() argument
524 static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_pid_t() argument
531 static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) in to_zval_read_uid_t() argument
540 static void from_zval_write_sin_addr(const zval *zaddr_str, char *inaddr, ser_context *ctx) in from_zval_write_sin_addr() argument
547 res = php_set_inet_addr(&saddr, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin_addr()
552 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET " in from_zval_write_sin_addr()
558 static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin_addr() argument
568 do_to_zval_err(ctx, "could not convert IPv4 address to string " in to_zval_read_sin_addr()
581 static void from_zval_write_sockaddr_in(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_in() argument
583 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_in, ctx); in from_zval_write_sockaddr_in()
585 static void to_zval_read_sockaddr_in(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in() argument
587 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in, ctx); in to_zval_read_sockaddr_in()
590 static void from_zval_write_sin6_addr(const zval *zaddr_str, char *addr6, ser_context *ctx) in from_zval_write_sin6_addr() argument
597 res = php_set_inet6_addr(&saddr6, ZSTR_VAL(addr_str), ctx->sock); in from_zval_write_sin6_addr()
602 do_from_zval_err(ctx, "could not resolve address '%s' to get an AF_INET6 " in from_zval_write_sin6_addr()
608 static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) in to_zval_read_sin6_addr() argument
619 do_to_zval_err(ctx, "could not convert IPv6 address to string " in to_zval_read_sin6_addr()
634 static void from_zval_write_sockaddr_in6(const zval *container, char *sockaddr6, ser_context *ctx) in from_zval_write_sockaddr_in6() argument
636 from_zval_write_aggregation(container, sockaddr6, descriptors_sockaddr_in6, ctx); in from_zval_write_sockaddr_in6()
638 static void to_zval_read_sockaddr_in6(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_in6() argument
640 to_zval_read_aggregation(data, zv, descriptors_sockaddr_in6, ctx); in to_zval_read_sockaddr_in6()
643 static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_context *ctx) in from_zval_write_sun_path() argument
654 do_from_zval_err(ctx, "%s", "the path is cannot be empty"); in from_zval_write_sun_path()
659 do_from_zval_err(ctx, "the path is too long, the maximum permitted " in from_zval_write_sun_path()
670 static void to_zval_read_sun_path(const char *data, zval *zv, res_context *ctx) { in to_zval_read_sun_path() argument
676 do_to_zval_err(ctx, "could not find a NUL in the path"); in to_zval_read_sun_path()
687 static void from_zval_write_sockaddr_un(const zval *container, char *sockaddr, ser_context *ctx) in from_zval_write_sockaddr_un() argument
689 from_zval_write_aggregation(container, sockaddr, descriptors_sockaddr_un, ctx); in from_zval_write_sockaddr_un()
691 static void to_zval_read_sockaddr_un(const char *data, zval *zv, res_context *ctx) in to_zval_read_sockaddr_un() argument
693 to_zval_read_aggregation(data, zv, descriptors_sockaddr_un, ctx); in to_zval_read_sockaddr_un()
698 ser_context *ctx) in from_zval_write_sockaddr_aux() argument
705 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_sockaddr_aux()
709 fill_sockaddr = param_get_bool(ctx, KEY_FILL_SOCKADDR, 1); in from_zval_write_sockaddr_aux()
714 zend_llist_add_element(&ctx->keys, &node); in from_zval_write_sockaddr_aux()
715 from_zval_write_int(elem, (char*)&family, ctx); in from_zval_write_sockaddr_aux()
716 zend_llist_remove_tail(&ctx->keys); in from_zval_write_sockaddr_aux()
718 family = ctx->sock->type; in from_zval_write_sockaddr_aux()
724 if (ctx->sock->type != AF_INET && ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
725 do_from_zval_err(ctx, "the specified family (number %d) is not " in from_zval_write_sockaddr_aux()
729 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in), ctx); in from_zval_write_sockaddr_aux()
732 from_zval_write_sockaddr_in(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
739 if (ctx->sock->type != AF_INET6) { in from_zval_write_sockaddr_aux()
740 do_from_zval_err(ctx, "the specified family (AF_INET6) is not " in from_zval_write_sockaddr_aux()
744 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_in6), ctx); in from_zval_write_sockaddr_aux()
747 from_zval_write_sockaddr_in6(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
754 if (ctx->sock->type != AF_UNIX) { in from_zval_write_sockaddr_aux()
755 do_from_zval_err(ctx, "the specified family (AF_UNIX) is not " in from_zval_write_sockaddr_aux()
759 *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); in from_zval_write_sockaddr_aux()
763 from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); in from_zval_write_sockaddr_aux()
780 do_from_zval_err(ctx, "%s", "the only families currently supported are " in from_zval_write_sockaddr_aux()
785 static void to_zval_read_sockaddr_aux(const char *sockaddr_c, zval *zv, res_context *ctx) in to_zval_read_sockaddr_aux() argument
798 to_zval_read_sockaddr_in(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
803 to_zval_read_sockaddr_in6(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
808 to_zval_read_sockaddr_un(sockaddr_c, zv, ctx); in to_zval_read_sockaddr_aux()
812 do_to_zval_err(ctx, "cannot read struct sockaddr with family %d; " in to_zval_read_sockaddr_aux()
834 ser_context *ctx) in from_zval_write_control() argument
857 from_zval_write_aggregation(arr, (char *)&level, descriptor_level, ctx); in from_zval_write_control()
858 if (ctx->err.has_error) { in from_zval_write_control()
861 from_zval_write_aggregation(arr, (char *)&type, descriptor_type, ctx); in from_zval_write_control()
862 if (ctx->err.has_error) { in from_zval_write_control()
868 do_from_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in from_zval_write_control()
877 do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); in from_zval_write_control()
880 data_len = entry->calc_space(data_elem, ctx); in from_zval_write_control()
881 if (ctx->err.has_error) { in from_zval_write_control()
904 from_zval_write_aggregation(arr, (char*)CMSG_DATA(cmsghdr), descriptor_data, ctx); in from_zval_write_control()
908 static void from_zval_write_control_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_control_array() argument
922 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_control_array()
932 control_buf = accounted_safe_ecalloc(num_elems, CMSG_SPACE(20), 0, ctx); in from_zval_write_control_array()
933 alloc = ctx->allocations.tail; in from_zval_write_control_array()
938 if (ctx->err.has_error) { in from_zval_write_control_array()
945 zend_llist_add_element(&ctx->keys, &bufp); in from_zval_write_control_array()
947 from_zval_write_control(elem, &control_buf, alloc, &control_len, &cur_offset, ctx); in from_zval_write_control_array()
949 zend_llist_remove_tail(&ctx->keys); in from_zval_write_control_array()
955 static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_cmsg_data() argument
964 do_to_zval_err(ctx, "cmsghdr with level %d and type %d not supported", in to_zval_read_cmsg_data()
969 do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " in to_zval_read_cmsg_data()
977 if (zend_hash_str_add_ptr(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1, len_p) == NULL) { in to_zval_read_cmsg_data()
978 do_to_zval_err(ctx, "%s", "could not set parameter " KEY_CMSG_LEN); in to_zval_read_cmsg_data()
982 entry->to_array((const char *)CMSG_DATA(cmsg), zv, ctx); in to_zval_read_cmsg_data()
984 zend_hash_str_del(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1); in to_zval_read_cmsg_data()
986 static void to_zval_read_control(const char *cmsghdr_c, zval *zv, res_context *ctx) in to_zval_read_control() argument
997 to_zval_read_aggregation(cmsghdr_c, zv, descriptors, ctx); in to_zval_read_control()
999 static void to_zval_read_control_array(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_control_array() argument
1017 cmsg != NULL && !ctx->err.has_error; in to_zval_read_control_array()
1027 zend_llist_add_element(&ctx->keys, &bufp); in to_zval_read_control_array()
1029 to_zval_read_control((const char *)cmsg, elem, ctx); in to_zval_read_control_array()
1031 zend_llist_remove_tail(&ctx->keys); in to_zval_read_control_array()
1036 static void from_zval_write_name(const zval *zname_arr, char *msghdr_c, ser_context *ctx) in from_zval_write_name() argument
1042 from_zval_write_sockaddr_aux(zname_arr, &sockaddr, &sockaddr_len, ctx); in from_zval_write_name()
1047 static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx) in to_zval_read_name() argument
1053 to_zval_read_sockaddr_aux(name, zv, ctx); in to_zval_read_name()
1056 static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_buffer_size() argument
1061 lval = from_zval_integer_common(elem, ctx); in from_zval_write_msghdr_buffer_size()
1062 if (ctx->err.has_error) { in from_zval_write_msghdr_buffer_size()
1067 do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; " in from_zval_write_msghdr_buffer_size()
1073 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_buffer_size()
1074 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)lval, ctx); in from_zval_write_msghdr_buffer_size()
1077 static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, ser_context *ctx) in from_zval_write_iov_array_aux() argument
1084 msg->msg_iov[i - 1].iov_base = accounted_emalloc(ZSTR_LEN(str), ctx); in from_zval_write_iov_array_aux()
1090 static void from_zval_write_iov_array(const zval *arr, char *msghdr_c, ser_context *ctx) in from_zval_write_iov_array() argument
1096 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_iov_array()
1105 msg->msg_iov = accounted_safe_ecalloc(num_elem, sizeof *msg->msg_iov, 0, ctx); in from_zval_write_iov_array()
1108 from_array_iterate(arr, from_zval_write_iov_array_aux, (void**)&msg, ctx); in from_zval_write_iov_array()
1110 static void from_zval_write_controllen(const zval *elem, char *msghdr_c, ser_context *ctx) in from_zval_write_controllen() argument
1118 from_zval_write_uint32(elem, (char*)&len, ctx); in from_zval_write_controllen()
1119 if (!ctx->err.has_error && len == 0) { in from_zval_write_controllen()
1120 do_from_zval_err(ctx, "controllen cannot be 0"); in from_zval_write_controllen()
1123 msghdr->msg_control = accounted_emalloc(len, ctx); in from_zval_write_controllen()
1126 void from_zval_write_msghdr_send(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_send() argument
1135 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_send()
1137 void from_zval_write_msghdr_recv(const zval *container, char *msghdr_c, ser_context *ctx) in from_zval_write_msghdr_recv() argument
1163 …if (zend_hash_str_add_ptr(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1, (void *)… in from_zval_write_msghdr_recv()
1164 do_from_zval_err(ctx, "could not add fill_sockaddr; this is a bug"); in from_zval_write_msghdr_recv()
1168 from_zval_write_aggregation(container, msghdr_c, descriptors, ctx); in from_zval_write_msghdr_recv()
1170 zend_hash_str_del(&ctx->params, KEY_FILL_SOCKADDR, sizeof(KEY_FILL_SOCKADDR) - 1); in from_zval_write_msghdr_recv()
1171 if (ctx->err.has_error) { in from_zval_write_msghdr_recv()
1177 msghdr->msg_iov = accounted_emalloc(sizeof(*msghdr->msg_iov) * 1, ctx); in from_zval_write_msghdr_recv()
1178 msghdr->msg_iov[0].iov_base = accounted_emalloc((size_t)DEFAULT_BUFF_SIZE, ctx); in from_zval_write_msghdr_recv()
1183 static void to_zval_read_iov(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_iov() argument
1192 do_to_zval_err(ctx, "unexpectedly large value for iov_len: %lu", in to_zval_read_iov()
1197 …if ((recvmsg_ret = zend_hash_str_find_ptr(&ctx->params, KEY_RECVMSG_RET, sizeof(KEY_RECVMSG_RET) -… in to_zval_read_iov()
1198 do_to_zval_err(ctx, "recvmsg_ret not found in params. This is a bug"); in to_zval_read_iov()
1216 void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx) in to_zval_read_msghdr() argument
1228 to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx); in to_zval_read_msghdr()
1232 static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx) in from_zval_write_ifindex() argument
1238 do_from_zval_err(ctx, "the interface index cannot be negative or " in from_zval_write_ifindex()
1251 do_from_zval_err(ctx, "no interface with name \"%s\" could be found", ZSTR_VAL(str)); in from_zval_write_ifindex()
1258 do_from_zval_err(ctx, "the interface name \"%s\" is too large ", ZSTR_VAL(str)); in from_zval_write_ifindex()
1259 } else if (ioctl(ctx->sock->bsd_socket, SIOCGIFINDEX, &ifr) < 0) { in from_zval_write_ifindex()
1261 do_from_zval_err(ctx, "no interface with name \"%s\" could be " in from_zval_write_ifindex()
1264 do_from_zval_err(ctx, "error fetching interface index for " in from_zval_write_ifindex()
1273 do_from_zval_err(ctx, in from_zval_write_ifindex()
1281 if (!ctx->err.has_error) { in from_zval_write_ifindex()
1293 void from_zval_write_in6_pktinfo(const zval *container, char *in6_pktinfo_c, ser_context *ctx) in from_zval_write_in6_pktinfo() argument
1295 from_zval_write_aggregation(container, in6_pktinfo_c, descriptors_in6_pktinfo, ctx); in from_zval_write_in6_pktinfo()
1297 void to_zval_read_in6_pktinfo(const char *data, zval *zv, res_context *ctx) in to_zval_read_in6_pktinfo() argument
1301 to_zval_read_aggregation(data, zv, descriptors_in6_pktinfo, ctx); in to_zval_read_in6_pktinfo()
1314 void from_zval_write_ucred(const zval *container, char *ucred_c, ser_context *ctx) in from_zval_write_ucred() argument
1316 from_zval_write_aggregation(container, ucred_c, descriptors_ucred, ctx); in from_zval_write_ucred()
1318 void to_zval_read_ucred(const char *data, zval *zv, res_context *ctx) in to_zval_read_ucred() argument
1322 to_zval_read_aggregation(data, zv, descriptors_ucred, ctx); in to_zval_read_ucred()
1328 size_t calculate_scm_rights_space(const zval *arr, ser_context *ctx) in calculate_scm_rights_space() argument
1333 do_from_zval_err(ctx, "%s", "expected an array here"); in calculate_scm_rights_space()
1339 do_from_zval_err(ctx, "%s", "expected at least one element in this array"); in calculate_scm_rights_space()
1345 static void from_zval_write_fd_array_aux(zval *elem, unsigned i, void **args, ser_context *ctx) in from_zval_write_fd_array_aux() argument
1361 do_from_zval_err(ctx, "resource is not a stream or a socket"); in from_zval_write_fd_array_aux()
1367 do_from_zval_err(ctx, "cast stream to file descriptor failed"); in from_zval_write_fd_array_aux()
1371 do_from_zval_err(ctx, "expected a resource variable"); in from_zval_write_fd_array_aux()
1374 void from_zval_write_fd_array(const zval *arr, char *int_arr, ser_context *ctx) in from_zval_write_fd_array() argument
1377 do_from_zval_err(ctx, "%s", "expected an array here"); in from_zval_write_fd_array()
1381 from_array_iterate(arr, &from_zval_write_fd_array_aux, (void**)&int_arr, ctx); in from_zval_write_fd_array()
1383 void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) in to_zval_read_fd_array() argument
1394 …if ((cmsg_len = zend_hash_str_find_ptr(&ctx->params, KEY_CMSG_LEN, sizeof(KEY_CMSG_LEN) - 1)) == N… in to_zval_read_fd_array()
1395 do_to_zval_err(ctx, "could not get value of parameter " KEY_CMSG_LEN); in to_zval_read_fd_array()
1400 do_to_zval_err(ctx, "length of cmsg is smaller than its data member " in to_zval_read_fd_array()
1417 do_to_zval_err(ctx, "error creating resource for received file " in to_zval_read_fd_array()
1447 ser_context ctx; in from_zval_run_conversions() local
1456 memset(&ctx, 0, sizeof(ctx)); in from_zval_run_conversions()
1457 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in from_zval_run_conversions()
1458 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in from_zval_run_conversions()
1459 zend_llist_init(&ctx.allocations, sizeof(void *), &free_from_zval_allocation, 0); in from_zval_run_conversions()
1460 ctx.sock = sock; in from_zval_run_conversions()
1464 zend_llist_add_element(&ctx.keys, &top_name); in from_zval_run_conversions()
1465 zend_llist_add_element(&ctx.allocations, &structure); in from_zval_run_conversions()
1468 writer(container, structure, &ctx); in from_zval_run_conversions()
1470 if (ctx.err.has_error) { in from_zval_run_conversions()
1471 zend_llist_destroy(&ctx.allocations); /* deallocates structure as well */ in from_zval_run_conversions()
1473 *err = ctx.err; in from_zval_run_conversions()
1476 **allocations = ctx.allocations; in from_zval_run_conversions()
1479 zend_llist_destroy(&ctx.keys); in from_zval_run_conversions()
1480 zend_hash_destroy(&ctx.params); in from_zval_run_conversions()
1490 res_context ctx; in to_zval_run_conversions() local
1497 memset(&ctx, 0, sizeof(ctx)); in to_zval_run_conversions()
1498 zend_llist_init(&ctx.keys, sizeof(const char *), NULL, 0); in to_zval_run_conversions()
1499 zend_llist_add_element(&ctx.keys, &top_name); in to_zval_run_conversions()
1501 zend_hash_init(&ctx.params, 8, NULL, NULL, 0); in to_zval_run_conversions()
1503 zend_hash_str_update_ptr(&ctx.params, kv->key, kv->key_size - 1, kv->value); in to_zval_run_conversions()
1508 reader(structure, zv, &ctx); in to_zval_run_conversions()
1510 if (ctx.err.has_error) { in to_zval_run_conversions()
1513 *err = ctx.err; in to_zval_run_conversions()
1516 zend_llist_destroy(&ctx.keys); in to_zval_run_conversions()
1517 zend_hash_destroy(&ctx.params); in to_zval_run_conversions()