From: Michael Wallner Date: Wed, 8 Jun 2022 15:22:34 +0000 (+0200) Subject: Backport v4 updates X-Git-Tag: v4.2.3~4^2 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=e3976774f27b4129cbfd7d227aaa7e177f1b735c;hp=-c Backport v4 updates --- e3976774f27b4129cbfd7d227aaa7e177f1b735c diff --combined .gitignore index c7fc94c,a20dd1d..5ebf7aa --- a/.gitignore +++ b/.gitignore @@@ -1,8 -1,9 +1,9 @@@ .cproject .deps + *.dep .libs/ .project - Makefile + /Makefile Makefile.fragments Makefile.global Makefile.objects @@@ -10,6 -11,7 +11,7 @@@ acinclude.m aclocal.m4 autom4te.cache/ build/ + config.cache config.guess config.h config.h.in @@@ -18,6 -20,7 +20,7 @@@ config.nic config.status config.sub configure + configure.ac configure.in http.la install-sh @@@ -81,4 -84,3 +84,4 @@@ vendor /tests/helper/server.log *gcov *lcov +*.loT diff --combined config9.m4 index 4f6d589,695701b..89d7b28 --- a/config9.m4 +++ b/config9.m4 @@@ -24,26 -24,30 +24,30 @@@ if test "$PHP_HTTP" != "no"; the AC_CHECK_LIB(nsl, getdomainname) ]) AC_CHECK_FUNCS(mbrtowc mbtowc iswalnum inet_pton) + + CFLAGS="$CFLAGS -Wno-strict-prototypes" dnl ZLIB PHP_ARG_WITH([http-zlib-dir], [whether/where to check for zlib], - [ --with-http-zlib-dir[=DIR] HTTP: where to find zlib], $PHP_HTTP, no) + [ --with-http-zlib-dir[=DIR] HTTP: where to find zlib], $PHP_HTTP) PECL_CHECK_ZLIB([$PHP_HTTP_ZLIB_DIR], [1.2.0.4]) PECL_CHECK_DONE(zlib, $PECL_VAR([HAVE_ZLIB])) - + dnl BROTLI PHP_ARG_WITH([http-libbrotli-dir], [whether/where to check for libbrotli], - [ --with-http-libbrotli-dir[=DIR] HTTP: where to find libbrotli], $PHP_HTTP, no) + [ --with-http-libbrotli-dir[=DIR] HTTP: where to find libbrotli], $PHP_HTTP) PECL_CHECK_LIBBROTLI([$PHP_HTTP_LIBBROTLI_DIR], [1.0]) PECL_CHECK_DONE(libbrotli, $PECL_VAR([HAVE_LIBBROTLI])) dnl CURL PHP_ARG_WITH([http-libcurl-dir], [whether/where to check for libcurl], - [ --with-http-libcurl-dir[=DIR] HTTP: where to find libcurl], $PHP_HTTP, no) + [ --with-http-libcurl-dir[=DIR] HTTP: where to find libcurl], $PHP_HTTP) if test "$PHP_HTTP_LIBCURL_DIR" != "no"; then PECL_CHECK_LIBCURL([$PHP_HTTP_LIBCURL_DIR], [7.18.2]) PECL_HAVE_LIBCURL_PROTOCOL([HTTP], [ PECL_HAVE_LIBCURL_FEATURE([HTTP2]) + PECL_HAVE_LIBCURL_FEATURE([ALT-SVC]) + PECL_HAVE_LIBCURL_FEATURE([HSTS]) PECL_HAVE_LIBCURL_ARES PECL_HAVE_LIBCURL_SSL PECL_HAVE_LIBCURL_CA @@@ -165,12 -169,6 +169,12 @@@ ], [ AC_MSG_ERROR([please install and enable pecl/raphf]) ]) + PECL_HAVE_PHP_EXT([propro], [ + PECL_HAVE_PHP_EXT_HEADER([propro]) + ], [ + AC_MSG_ERROR([please install and enable pecl/propro]) + ]) + PECL_HAVE_PHP_EXT([hash]) PECL_HAVE_PHP_EXT([iconv]) dnl DONE @@@ -200,7 -198,6 +204,7 @@@ fi fi PHP_ADD_EXTENSION_DEP([http], [raphf], true) + PHP_ADD_EXTENSION_DEP([http], [propro], true) PHP_SUBST(PECL_VAR([HEADERS])) PHP_SUBST(PECL_VAR([SOURCES])) diff --combined package.xml index e0c0916,2c8b432..0576cf2 --- a/package.xml +++ b/package.xml @@@ -31,10 -31,10 +31,10 @@@ https://mdref.m6w6.name/htt mike@php.net yes -- 2022-02-25 ++ 2022-06-10 - 3.2.5 - 3.2.0 - 4.2.2 - 4.2.0 ++ 3.3.0 ++ 3.3.0 stable @@@ -42,7 -42,7 +42,7 @@@ BSD-2-Clause @@@ -250,6 -250,7 +250,7 @@@ + @@@ -286,6 -287,7 +287,7 @@@ + @@@ -305,7 -307,6 +307,7 @@@ + @@@ -347,8 -348,6 +349,8 @@@ + + @@@ -376,9 -375,11 +378,9 @@@ - - @@@ -386,9 -387,7 +388,9 @@@ - 8.0.0 + 7.0.0 + 8.0.0 + 8.0.0 1.4.1 @@@ -399,12 -398,6 +401,12 @@@ 2.0.0dev raphf + + propro + pecl.php.net + 2.0.0dev + propro + hash diff --combined php_http.h index c2a5b95,f4b4b33..d57f6e4 --- a/php_http.h +++ b/php_http.h @@@ -13,7 -13,7 +13,7 @@@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H - #define PHP_PECL_HTTP_VERSION "3.2.5" -#define PHP_PECL_HTTP_VERSION "4.2.2" ++#define PHP_PECL_HTTP_VERSION "3.3.0dev" extern zend_module_entry http_module_entry; #define phpext_http_ptr &http_module_entry diff --combined src/php_http_client.c index 9551dd0,a272fa4..d2f6204 --- a/src/php_http_client.c +++ b/src/php_http_client.c @@@ -74,7 -74,7 +74,7 @@@ void php_http_client_options_set_subr(z zval old_opts_tmp, *old_opts, new_opts, *entry = NULL; array_init(&new_opts); - old_opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &old_opts_tmp); + old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts)); @@@ -97,7 -97,7 +97,7 @@@ } } - zend_update_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), &new_opts); + zend_update_property(this_ce, instance, ZEND_STRL("options"), &new_opts); zval_ptr_dtor(&new_opts); } } @@@ -112,7 -112,7 +112,7 @@@ void php_http_client_options_set(zval * array_init(&new_opts); if (!opts || !zend_hash_num_elements(Z_ARRVAL_P(opts))) { - zend_update_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), &new_opts); + zend_update_property(this_ce, instance, ZEND_STRL("options"), &new_opts); zval_ptr_dtor(&new_opts); } else { zval old_opts_tmp, *old_opts, add_opts, *opt; @@@ -125,9 -125,9 +125,9 @@@ if (Z_TYPE_P(opt) == IS_ARRAY && (zend_string_equals_literal(key.key, "ssl") || zend_string_equals_literal(key.key, "cookies"))) { php_http_client_options_set_subr(instance, key.key->val, key.key->len, opt, 0); } else if (is_client && (zend_string_equals_literal(key.key, "recordHistory") || zend_string_equals_literal(key.key, "responseMessageClass"))) { - zend_update_property(this_ce, Z_OBJ_P(instance), key.key->val, key.key->len, opt); + zend_update_property(this_ce, instance, key.key->val, key.key->len, opt); } else if (Z_TYPE_P(opt) == IS_NULL) { - old_opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &old_opts_tmp); + old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); if (Z_TYPE_P(old_opts) == IS_ARRAY) { zend_symtable_del(Z_ARRVAL_P(old_opts), key.key); } @@@ -139,12 -139,12 +139,12 @@@ } ZEND_HASH_FOREACH_END(); - old_opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &old_opts_tmp); + old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts)); } array_join(Z_ARRVAL(add_opts), Z_ARRVAL(new_opts), 0, 0); - zend_update_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), &new_opts); + zend_update_property(this_ce, instance, ZEND_STRL("options"), &new_opts); zval_ptr_dtor(&new_opts); zval_ptr_dtor(&add_opts); } @@@ -153,7 -153,7 +153,7 @@@ void php_http_client_options_get_subr(zval *instance, char *key, size_t len, zval *return_value) { zend_class_entry *this_ce = Z_OBJCE_P(instance); - zval *options, opts_tmp, *opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &opts_tmp); + zval *options, opts_tmp, *opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &opts_tmp); if ((Z_TYPE_P(opts) == IS_ARRAY) && (options = zend_symtable_str_find(Z_ARRVAL_P(opts), key, len))) { RETVAL_ZVAL(options, 1, 0); @@@ -254,6 -254,20 +254,20 @@@ ZEND_RESULT_CODE php_http_client_dequeu return FAILURE; } + ZEND_RESULT_CODE php_http_client_requeue(php_http_client_t *h, php_http_message_t *request) + { + if (h->ops->dequeue) { + php_http_client_enqueue_t *enqueue = php_http_client_enqueued(h, request, NULL); + + if (!enqueue) { + php_error_docref(NULL, E_WARNING, "Failed to requeue request; request not in queue"); + return FAILURE; + } + return h->ops->requeue(h, enqueue); + } + return FAILURE; + } + php_http_client_enqueue_t *php_http_client_enqueued(php_http_client_t *h, void *compare_arg, php_http_client_enqueue_cmp_func_t compare_func) { zend_llist_element *el = NULL; @@@ -367,11 -381,11 +381,11 @@@ zend_object *php_http_client_object_new return &php_http_client_object_new_ex(ce, NULL)->zo; } -static HashTable *php_http_client_object_get_gc(zend_object *object, zval **table, int *n) +static HashTable *php_http_client_object_get_gc(zval *object, zval **table, int *n) { - php_http_client_object_t *obj = PHP_HTTP_OBJ(object, NULL); + php_http_client_object_t *obj = PHP_HTTP_OBJ(NULL, object); zend_llist_element *el = NULL; - HashTable *props = object->handlers->get_properties(object); + HashTable *props = Z_OBJPROP_P(object); uint32_t count = zend_hash_num_elements(props) + zend_llist_count(&obj->client->responses) + zend_llist_count(&obj->client->requests) + 2; zval *val; @@@ -417,7 -431,7 +431,7 @@@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_message_t *response) { - zval new_hist, old_hist_tmp, *old_hist = zend_read_property(php_http_client_class_entry, Z_OBJ_P(zclient), ZEND_STRL("history"), 0, &old_hist_tmp); + zval new_hist, old_hist_tmp, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0, &old_hist_tmp); php_http_message_t *req_copy = php_http_message_copy(request, NULL); php_http_message_t *res_copy = php_http_message_copy(response, NULL); php_http_message_t *zipped = php_http_message_zip(res_copy, req_copy); @@@ -429,7 -443,7 +443,7 @@@ php_http_message_object_prepend(&new_hist, old_hist, 1); } - zend_update_property(php_http_client_class_entry, Z_OBJ_P(zclient), ZEND_STRL("history"), &new_hist); + zend_update_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), &new_hist); zval_ptr_dtor(&new_hist); } @@@ -450,7 -464,7 +464,7 @@@ static ZEND_RESULT_CODE handle_response /* ensure the message is of type response (could be uninitialized in case of early error, like DNS) */ php_http_message_set_type(msg, PHP_HTTP_RESPONSE); - if (zend_is_true(zend_read_property(php_http_client_class_entry, Z_OBJ(zclient), ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) { + if (zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) { handle_history(&zclient, e->request, *response); } @@@ -467,7 -481,7 +481,7 @@@ object_init(&info); info_ht = HASH_OF(&info); php_http_client_getopt(client, PHP_HTTP_CLIENT_OPT_TRANSFER_INFO, e->request, &info_ht); - zend_update_property(php_http_get_client_response_class_entry(), Z_OBJ(zresponse), ZEND_STRL("transferInfo"), &info); + zend_update_property(php_http_get_client_response_class_entry(), &zresponse, ZEND_STRL("transferInfo"), &info); zval_ptr_dtor(&info); zend_llist_add_element(&client->responses, &msg_obj); @@@ -548,12 -562,11 +562,12 @@@ static void handle_debug(void *arg, php ZVAL_STRINGL(&zdata, data, size); zend_replace_error_handling(EH_NORMAL, NULL, &zeh); - zend_fcall_info_argn(&client_obj->debug.fci, 4, &zclient, &zreq, &ztype, &zdata); - ++client->callback.depth; - zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL); - --client->callback.depth; - zend_fcall_info_args_clear(&client_obj->debug.fci, 0); + if (SUCCESS == zend_fcall_info_argn(&client_obj->debug.fci, 4, &zclient, &zreq, &ztype, &zdata)) { + ++client->callback.depth; + zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL); + --client->callback.depth; + zend_fcall_info_args_clear(&client_obj->debug.fci, 0); + } zend_restore_error_handling(&zeh); zval_ptr_dtor(&zclient); @@@ -593,7 -606,7 +607,7 @@@ static PHP_METHOD(HttpClient, __constru } object_init_ex(&os, spl_ce_SplObjectStorage); - zend_update_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), &os); + zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), &os); zval_ptr_dtor(&os); if (persistent_handle_name) { @@@ -633,25 -646,28 +647,28 @@@ static PHP_METHOD(HttpClient, reset RETVAL_ZVAL(getThis(), 1, 0); } - static HashTable *combined_options(zval *client, zval *request) + static HashTable *combined_options(HashTable *options, zval *client, zval *request) { - HashTable *options; unsigned num_options = 0; - zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, Z_OBJ_P(client), ZEND_STRL("options"), 0, &z_options_tmp); + zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, client, ZEND_STRL("options"), 0, &z_options_tmp); if (Z_TYPE_P(z_coptions) == IS_ARRAY) { num_options = zend_hash_num_elements(Z_ARRVAL_P(z_coptions)); } ZVAL_UNDEF(&z_roptions); - zend_call_method_with_0_params(Z_OBJ_P(request), NULL, NULL, "getOptions", &z_roptions); + zend_call_method_with_0_params(request, NULL, NULL, "getOptions", &z_roptions); if (Z_TYPE(z_roptions) == IS_ARRAY) { unsigned num = zend_hash_num_elements(Z_ARRVAL(z_roptions)); if (num > num_options) { num_options = num; } } - ALLOC_HASHTABLE(options); - ZEND_INIT_SYMTABLE_EX(options, num_options, 0); + if (options) { + zend_hash_clean(options); + } else { + ALLOC_HASHTABLE(options); + ZEND_INIT_SYMTABLE_EX(options, num_options, 0); + } if (Z_TYPE_P(z_coptions) == IS_ARRAY) { array_copy(Z_ARRVAL_P(z_coptions), options); } @@@ -714,7 -730,7 +731,7 @@@ static PHP_METHOD(HttpClient, enqueue Z_ADDREF_P(request); q.request = msg_obj->message; - q.options = combined_options(getThis(), request); + q.options = combined_options(NULL, getThis(), request); q.dtor = msg_queue_dtor; q.opaque = msg_obj; q.closure.fci = fci; @@@ -770,19 -786,33 +787,33 @@@ static PHP_METHOD(HttpClient, requeue zend_fcall_info_cache fcc = empty_fcall_info_cache; php_http_client_object_t *obj; php_http_message_object_t *msg_obj; - php_http_client_enqueue_t q; + php_http_client_enqueue_t q, *e; php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O|f", &request, php_http_get_client_request_class_entry(), &fci, &fcc), invalid_arg, return); obj = PHP_HTTP_OBJ(NULL, getThis()); msg_obj = PHP_HTTP_OBJ(NULL, request); - if (php_http_client_enqueued(obj->client, msg_obj->message, NULL)) { - php_http_expect(SUCCESS == php_http_client_dequeue(obj->client, msg_obj->message), runtime, return); + if ((e = php_http_client_enqueued(obj->client, msg_obj->message, NULL))) { + combined_options(e->options, getThis(), request); + php_http_expect(SUCCESS == php_http_client_requeue(obj->client, msg_obj->message), runtime, return); + if (fci.size) { + if (e->closure.fci.size) { + zval_ptr_dtor(&e->closure.fci.function_name); + if (e->closure.fci.object) { + zend_object_release(e->closure.fci.object); + } + } + Z_TRY_ADDREF(fci.function_name); + if (fci.object) { + GC_ADDREF(fci.object); + } + } + RETURN_ZVAL(getThis(), 1, 0); } q.request = msg_obj->message; - q.options = combined_options(getThis(), request); + q.options = combined_options(NULL, getThis(), request); q.dtor = msg_queue_dtor; q.opaque = msg_obj; q.closure.fci = fci; @@@ -805,7 -835,7 +836,7 @@@ RETVAL_ZVAL(getThis(), 1, 0); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_count, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_count, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, count) { @@@ -868,7 -898,7 +899,7 @@@ static PHP_METHOD(HttpClient, getHistor php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - zhistory = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("history"), 0, &zhistory_tmp); + zhistory = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0, &zhistory_tmp); RETVAL_ZVAL(zhistory, 1, 0); } @@@ -985,7 -1015,11 +1016,7 @@@ static int notify(zend_object_iterator return ZEND_HASH_APPLY_STOP; } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_notify, 0, 0, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0) -#endif ZEND_ARG_OBJ_INFO(0, request, http\\Client\\Request, 1) ZEND_ARG_INFO(0, progress) ZEND_END_ARG_INFO(); @@@ -998,7 -1032,7 +1029,7 @@@ static PHP_METHOD(HttpClient, notify php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!o!", &request, php_http_get_client_request_class_entry(), &zprogress), invalid_arg, return); client_obj = PHP_HTTP_OBJ(NULL, getThis()); - observers = zend_read_property(php_http_client_class_entry, &client_obj->zo, ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@@ -1029,11 -1063,16 +1060,11 @@@ zval_ptr_dtor(zprogress); } } -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_attach, 0, 1, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1) -#endif ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, attach) @@@ -1044,7 -1083,7 +1075,7 @@@ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return); client_obj = PHP_HTTP_OBJ(NULL, getThis()); - observers = zend_read_property(php_http_client_class_entry, &client_obj->zo, ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@@ -1056,13 -1095,18 +1087,13 @@@ } ZVAL_UNDEF(&retval); - zend_call_method_with_1_params(Z_OBJ_P(observers), NULL, NULL, "attach", &retval, observer); + zend_call_method_with_1_params(observers, NULL, NULL, "attach", &retval, observer); zval_ptr_dtor(&retval); -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_detach, 0, 1, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1) -#endif ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, detach) @@@ -1071,7 -1115,7 +1102,7 @@@ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return); - observers = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@@ -1079,10 -1123,11 +1110,10 @@@ } ZVAL_UNDEF(&retval); - zend_call_method_with_1_params(Z_OBJ_P(observers), NULL, NULL, "detach", &retval, observer); + zend_call_method_with_1_params(observers, NULL, NULL, "detach", &retval, observer); zval_ptr_dtor(&retval); -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getObservers, 0, 0, 0) @@@ -1093,7 -1138,7 +1124,7 @@@ static PHP_METHOD(HttpClient, getObserv php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - observers = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@@ -1169,7 -1214,7 +1200,7 @@@ ZEND_END_ARG_INFO() static PHP_METHOD(HttpClient, getOptions) { if (SUCCESS == zend_parse_parameters_none()) { - zval options_tmp, *options = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("options"), 0, &options_tmp); + zval options_tmp, *options = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0, &options_tmp); RETVAL_ZVAL(options, 1, 0); } } @@@ -1358,7 -1403,7 +1389,7 @@@ PHP_MINIT_FUNCTION(http_client INIT_NS_CLASS_ENTRY(ce, "http", "Client", php_http_client_methods); php_http_client_class_entry = zend_register_internal_class_ex(&ce, NULL); php_http_client_class_entry->create_object = php_http_client_object_new; - zend_class_implements(php_http_client_class_entry, 2, spl_ce_SplSubject, zend_ce_countable); + zend_class_implements(php_http_client_class_entry, 2, spl_ce_SplSubject, spl_ce_Countable); memcpy(&php_http_client_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_client_object_handlers.offset = XtOffsetOf(php_http_client_object_t, zo); php_http_client_object_handlers.free_obj = php_http_client_object_free; diff --combined src/php_http_cookie.c index 1186ca0,dd4c6c6..cd3198c --- a/src/php_http_cookie.c +++ b/src/php_http_cookie.c @@@ -17,16 -17,16 +17,16 @@@ php_http_cookie_list_t *php_http_cookie if (!list) { list = emalloc(sizeof(*list)); } - + zend_hash_init(&list->cookies, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_init(&list->extras, 0, NULL, ZVAL_PTR_DTOR, 0); - + list->path = NULL; list->domain = NULL; list->expires = -1; list->max_age = -1; list->flags = 0; - + return list; } @@@ -51,7 -51,7 +51,7 @@@ void php_http_cookie_list_dtor(php_http if (list) { zend_hash_destroy(&list->cookies); zend_hash_destroy(&list->extras); - + PTR_SET(list->path, NULL); PTR_SET(list->domain, NULL); } @@@ -206,15 -206,15 +206,15 @@@ void php_http_cookie_list_to_struct(php { zval cookies, extras, tmp; HashTable *ht = HASH_OF(strct); - + array_init_size(&cookies, zend_hash_num_elements(&list->cookies)); array_copy(&list->cookies, Z_ARRVAL(cookies)); zend_symtable_str_update(ht, ZEND_STRL("cookies"), &cookies); - + array_init_size(&extras, zend_hash_num_elements(&list->extras)); array_copy(&list->extras, Z_ARRVAL(extras)); zend_symtable_str_update(ht, ZEND_STRL("extras"), &extras); - + ZVAL_LONG(&tmp, list->flags); zend_symtable_str_update(ht, ZEND_STRL("flags"), &tmp); ZVAL_LONG(&tmp, list->expires); @@@ -286,22 -286,22 +286,22 @@@ php_http_cookie_list_t *php_http_cookie list->domain = estrndup(str->val, str->len); zend_string_release(str); } - + return list; } static inline void append_encoded(php_http_buffer_t *buf, const char *key, size_t key_len, const char *val, size_t val_len) { zend_string *enc_str[2]; - + enc_str[0] = php_raw_url_encode(key, key_len); enc_str[1] = php_raw_url_encode(val, val_len); - + php_http_buffer_append(buf, enc_str[0]->val, enc_str[0]->len); php_http_buffer_appends(buf, "="); php_http_buffer_append(buf, enc_str[1]->val, enc_str[1]->len); php_http_buffer_appends(buf, "; "); - + zend_string_release(enc_str[0]); zend_string_release(enc_str[1]); } @@@ -311,7 -311,7 +311,7 @@@ void php_http_cookie_list_to_string(php php_http_buffer_t buf; zend_hash_key key; zval *val; - + php_http_buffer_init(&buf); ZEND_HASH_FOREACH_KEY_VAL(&list->cookies, key.h, key.key, val) @@@ -325,7 -325,7 +325,7 @@@ zend_string_release(str); } ZEND_HASH_FOREACH_END(); - + if (list->domain && *list->domain) { php_http_buffer_appendf(&buf, "domain=%s; ", list->domain); } @@@ -340,7 -340,7 +340,7 @@@ if (list->max_age >= 0) { php_http_buffer_appendf(&buf, "max-age=%ld; ", list->max_age); } - + ZEND_HASH_FOREACH_KEY_VAL(&list->extras, key.h, key.key, val) { zend_string *str = zval_get_string(val); @@@ -352,14 -352,14 +352,14 @@@ zend_string_release(str); } ZEND_HASH_FOREACH_END(); - + if (list->flags & PHP_HTTP_COOKIE_SECURE) { php_http_buffer_appends(&buf, "secure; "); } if (list->flags & PHP_HTTP_COOKIE_HTTPONLY) { php_http_buffer_appends(&buf, "httpOnly; "); } - + php_http_buffer_fix(&buf); *str = buf.data; *len = buf.used; @@@ -406,9 -406,9 +406,9 @@@ php_http_cookie_object_t *php_http_cook } \ } while(0) -zend_object *php_http_cookie_object_clone(zend_object *obj) +zend_object *php_http_cookie_object_clone(zval *obj) { - php_http_cookie_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(obj, NULL); + php_http_cookie_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(NULL, obj); PHP_HTTP_COOKIE_OBJECT_INIT(old_obj); @@@ -943,7 -943,7 +943,7 @@@ static PHP_METHOD(HttpCookie, setFlags } ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toString, 0, 0, 0) - ZEND_END_ARG_INFO();; + ZEND_END_ARG_INFO(); static PHP_METHOD(HttpCookie, toString) { php_http_cookie_object_t *obj; @@@ -981,6 -981,9 +981,6 @@@ static PHP_METHOD(HttpCookie, toArray php_http_cookie_list_to_struct(obj->list, return_value); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpCookie___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_cookie_methods[] = { PHP_ME(HttpCookie, __construct, ai_HttpCookie___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpCookie, getCookies, ai_HttpCookie_getCookies, ZEND_ACC_PUBLIC) @@@ -1010,7 -1013,7 +1010,7 @@@ PHP_ME(HttpCookie, toArray, ai_HttpCookie_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpCookie, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; diff --combined src/php_http_env.c index 4afcd31,9c88822..fdbdd92 --- a/src/php_http_env.c +++ b/src/php_http_env.c @@@ -15,6 -15,12 +15,12 @@@ PHP_RSHUTDOWN_FUNCTION(http_env) + { + php_http_env_reset(); + return SUCCESS; + } + + void php_http_env_reset() { if (PHP_HTTP_G->env.request.headers) { zend_hash_destroy(PHP_HTTP_G->env.request.headers); @@@ -24,13 -30,10 +30,10 @@@ if (PHP_HTTP_G->env.request.body) { php_http_message_body_free(&PHP_HTTP_G->env.request.body); } - if (PHP_HTTP_G->env.server_var) { zval_ptr_dtor(PHP_HTTP_G->env.server_var); PHP_HTTP_G->env.server_var = NULL; } - - return SUCCESS; } void php_http_env_get_request_headers(HashTable *headers) @@@ -414,10 -417,12 +417,10 @@@ ZEND_RESULT_CODE php_http_env_set_respo { sapi_header_line h = {NULL, 0, 0}; ZEND_RESULT_CODE ret; - char *line; - h.line_len = spprintf(&line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code)); - h.line = line; + h.line_len = spprintf(&h.line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code)); ret = sapi_header_op(SAPI_HEADER_REPLACE, (void *) &h); - efree(line); + efree(h.line); return ret; } @@@ -429,10 -434,9 +432,10 @@@ ZEND_RESULT_CODE php_http_env_set_respo ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace) { - sapi_header_line h = {header_str, header_len, http_code}; + sapi_header_line h = {estrndup(header_str, header_len), header_len, http_code}; ZEND_RESULT_CODE ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); + efree(h.line); return ret; } @@@ -440,14 -444,16 +443,14 @@@ ZEND_RESULT_CODE php_http_env_set_respo { ZEND_RESULT_CODE ret = FAILURE; sapi_header_line h = {NULL, 0, http_code}; - char *line; - h.line_len = vspprintf(&line, 0, fmt, argv); - h.line = line; + h.line_len = vspprintf(&h.line, 0, fmt, argv); if (h.line) { if (h.line_len) { ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); } - efree(line); + efree(h.line); } return ret; } @@@ -496,17 -502,19 +499,17 @@@ ZEND_RESULT_CODE php_http_env_set_respo } else { sapi_header_line h; ZEND_RESULT_CODE ret; - char *line; if (name_len > INT_MAX) { return FAILURE; } h.response_code = http_code; - h.line_len = spprintf(&line, 0, "%s: %s", name_str, data->val); - h.line = line; + h.line_len = spprintf(&h.line, 0, "%s: %s", name_str, data->val); ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); zend_string_release(data); - PTR_FREE(line); + PTR_FREE(h.line); return ret; } @@@ -774,6 -782,15 +777,15 @@@ static PHP_METHOD(HttpEnv, negotiate } } + ZEND_BEGIN_ARG_INFO(ai_HttpEnv_reset, 0) + ZEND_END_ARG_INFO(); + static PHP_METHOD(HttpEnv, reset) + { + zend_parse_parameters_none(); + php_http_env_reset(); + } + + static zend_function_entry php_http_env_methods[] = { PHP_ME(HttpEnv, getRequestHeader, ai_HttpEnv_getRequestHeader, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(HttpEnv, getRequestBody, ai_HttpEnv_getRequestBody, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@@ -792,6 -809,8 +804,8 @@@ PHP_ME(HttpEnv, negotiateCharset, ai_HttpEnv_negotiateCharset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(HttpEnv, negotiate, ai_HttpEnv_negotiate, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(HttpEnv, reset, ai_HttpEnv_reset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + EMPTY_FUNCTION_ENTRY }; diff --combined src/php_http_header.c index 4c9a702,c475a81..7044c21 --- a/src/php_http_header.c +++ b/src/php_http_header.c @@@ -17,18 -17,18 +17,18 @@@ ZEND_RESULT_CODE php_http_header_parse( php_http_header_parser_t ctx; php_http_buffer_t buf; php_http_header_parser_state_t rs; - + if (!php_http_buffer_from_string_ex(&buf, header, length)) { php_error_docref(NULL, E_WARNING, "Could not allocate buffer"); return FAILURE; } - + if (!php_http_header_parser_init(&ctx)) { php_http_buffer_dtor(&buf); php_error_docref(NULL, E_WARNING, "Could not initialize header parser"); return FAILURE; } - + rs = php_http_header_parser_parse(&ctx, &buf, PHP_HTTP_HEADER_PARSER_CLEANUP, headers, callback_func, callback_data); php_http_header_parser_dtor(&ctx); php_http_buffer_dtor(&buf); @@@ -183,11 -183,46 +183,11 @@@ PHP_METHOD(HttpHeader, __construct if (name_str && name_len) { char *pretty_str = estrndup(name_str, name_len); - zend_update_property_stringl(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len); + zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len); efree(pretty_str); } if (value_str && value_len) { - zend_update_property_stringl(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value_str, value_len); - } -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpHeader, __serialize) -{ - zval name, value, *ptr; - - zend_parse_parameters_none(); - - array_init(return_value); - ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name); - Z_TRY_ADDREF_P(ptr); - add_next_index_zval(return_value, ptr); - ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value); - Z_TRY_ADDREF_P(ptr); - add_next_index_zval(return_value, ptr); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpHeader, __unserialize) -{ - HashTable *ha; - zval *name, *value; - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &ha), invalid_arg, return); - name = zend_hash_index_find(ha, 0); - value = zend_hash_index_find(ha, 1); - - if (name && value) { - zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), name); - zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value); + zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("value"), value_str, value_len); } } @@@ -201,11 -236,11 +201,11 @@@ PHP_METHOD(HttpHeader, serialize zval name_tmp, value_tmp; php_http_buffer_init(&buf); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp)); php_http_buffer_appendz(&buf, zs); zend_string_release(zs); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if (zs->len) { php_http_buffer_appends(&buf, ": "); php_http_buffer_appendz(&buf, zs); @@@ -239,16 -274,16 +239,16 @@@ PHP_METHOD(HttpHeader, unserialize zend_hash_internal_pointer_reset(&ht); switch (zend_hash_get_current_key(&ht, &key, &idx)) { case HASH_KEY_IS_STRING: - zend_update_property_str(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), key); + zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("name"), key); break; case HASH_KEY_IS_LONG: - zend_update_property_long(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), idx); + zend_update_property_long(php_http_header_class_entry, getThis(), ZEND_STRL("name"), idx); break; default: break; } zs = zval_get_string(zend_hash_get_current_data(&ht)); - zend_update_property_str(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), zs); + zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("value"), zs); zend_string_release(zs); } } @@@ -273,7 -308,7 +273,7 @@@ PHP_METHOD(HttpHeader, match return; } - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); RETVAL_BOOL(php_http_match(zs->val, val_str, flags)); zend_string_release(zs); } @@@ -299,7 -334,7 +299,7 @@@ PHP_METHOD(HttpHeader, negotiate array_init(rs_array); } - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp)); if (zend_string_equals_literal(zs, "Accept")) { sep_str = "/"; sep_len = 1; @@@ -309,7 -344,7 +309,7 @@@ } zend_string_release(zs); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if ((rs = php_http_negotiate(zs->val, zs->len, supported, sep_str, sep_len))) { PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(rs, supported, rs_array); } else { @@@ -327,21 -362,21 +327,21 @@@ ZEND_END_ARG_INFO() PHP_METHOD(HttpHeader, getParams) { zval value_tmp, zctor, zparams_obj, *zargs = NULL; - + ZVAL_STRINGL(&zctor, "__construct", lenof("__construct")); - + object_init_ex(&zparams_obj, php_http_params_get_class_entry()); - + zargs = (zval *) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval)); - ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if (ZEND_NUM_ARGS()) { zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]); } - + if (SUCCESS == call_user_function(NULL, &zparams_obj, &zctor, return_value, ZEND_NUM_ARGS()+1, zargs)) { RETVAL_ZVAL(&zparams_obj, 0, 1); } - + zval_ptr_dtor(&zctor); if (zargs) { efree(zargs); @@@ -381,7 -416,7 +381,7 @@@ PHP_METHOD(HttpHeader, parse object_init_ex(&zho, ce); Z_TRY_ADDREF_P(val); - zend_call_method_with_2_params(Z_OBJ(zho), ce, NULL, "__construct", NULL, &zkey, val); + zend_call_method_with_2_params(&zho, ce, NULL, "__construct", NULL, &zkey, val); zval_ptr_dtor(val); zval_ptr_dtor(&zkey); @@@ -397,12 -432,17 +397,12 @@@ } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_header_methods[] = { PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, __unserialize, ai_HttpHeader___unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, __serialize, ai_HttpHeader___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader___toString, ZEND_ACC_PUBLIC) + PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, match, ai_HttpHeader_match, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, negotiate, ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, getParams, ai_HttpHeader_getParams, ZEND_ACC_PUBLIC) @@@ -436,4 -476,3 +436,3 @@@ PHP_MINIT_FUNCTION(http_header * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ - diff --combined src/php_http_message.c index 371ecb7,cd01757..2014aac --- a/src/php_http_message.c +++ b/src/php_http_message.c @@@ -332,7 -332,7 +332,7 @@@ static void message_headers(php_http_me char *tmp = NULL; size_t len = 0; - php_http_info_to_string((php_http_info_t *) msg, &tmp, &len, PHP_HTTP_CRLF TSRMLS_CC); + php_http_info_to_string((php_http_info_t *) msg, &tmp, &len, PHP_HTTP_CRLF); php_http_message_update_headers(msg); php_http_buffer_append(str, tmp, len); @@@ -509,9 -509,8 +509,9 @@@ zend_class_entry *php_http_message_get_ return php_http_message_class_entry; } -static zval *php_http_message_object_read_prop(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); -static zval *php_http_message_object_write_prop(zend_object *object, zend_string *member, zval *value, void **cache_slot); +static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv); + +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot); static zend_object_handlers php_http_message_object_handlers; static HashTable php_http_message_object_prophandlers; @@@ -648,15 -647,15 +648,15 @@@ static void php_http_message_object_pro } } static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value) { - if (obj->body) { - zval tmp; + zval tmp; - ZVAL_COPY_VALUE(&tmp, return_value); - RETVAL_OBJECT(&obj->body->zo, 1); - zval_ptr_dtor(&tmp); - } else { - RETVAL_NULL(); + if (!obj->body) { + RETURN_NULL(); } + + ZVAL_COPY_VALUE(&tmp, return_value); + RETVAL_OBJECT(&obj->body->zo, 1); + zval_ptr_dtor(&tmp); } static void php_http_message_object_prophandler_set_body(php_http_message_object_t *obj, zval *value) { php_http_message_object_set_body(obj, value); @@@ -689,6 -688,8 +689,8 @@@ static void php_http_message_object_pro do { \ if (!obj->message) { \ obj->message = php_http_message_init(NULL, 0, NULL); \ + } else if (!obj->body && php_http_message_body_size(obj->message->body)) { \ + php_http_message_object_init_body_object(obj); \ } \ } while(0) @@@ -857,10 -858,10 +859,10 @@@ php_http_message_object_t *php_http_mes return o; } -zend_object *php_http_message_object_clone(zend_object *this_ptr) +zend_object *php_http_message_object_clone(zval *this_ptr) { php_http_message_object_t *new_obj; - php_http_message_object_t *old_obj = PHP_HTTP_OBJ(this_ptr, NULL); + php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr); new_obj = php_http_message_object_new_ex(old_obj->zo.ce, php_http_message_copy(old_obj->message, NULL)); zend_objects_clone_members(&new_obj->zo, &old_obj->zo); @@@ -895,70 -896,53 +897,72 @@@ void php_http_message_object_free(zend_ zend_object_std_dtor(object); } -static zval *php_http_message_object_get_prop_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) +#if PHP_VERSION_ID >= 70400 +static zval *php_http_message_object_get_prop_ptr(zval *object, zval *member, int type, void **cache_slot) { return NULL; } +#endif -static zval *php_http_message_object_read_prop(zend_object *object, zend_string *member, int type, void **cache_slot, zval *tmp) +static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp) { zval *return_value; - php_http_message_object_prophandler_t *handler = php_http_message_object_get_prophandler(member); + zend_string *member_name = zval_get_string(member); + php_http_message_object_prophandler_t *handler = php_http_message_object_get_prophandler(member_name); return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp); if (handler && handler->read) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + if (type == BP_VAR_R || type == BP_VAR_IS) { + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); + + handler->read(obj, return_value); + } else { + php_property_proxy_t *proxy; + php_property_proxy_object_t *proxy_obj; + + proxy = php_property_proxy_init(object, member_name); + proxy_obj = php_property_proxy_object_new_ex(NULL, proxy); - handler->read(obj, return_value); + ZVAL_OBJ(tmp, &proxy_obj->zo); + return_value = tmp; + } } + + zend_string_release(member_name); return return_value; } -static zval *php_http_message_object_write_prop(zend_object *object, zend_string *member, zval *value, void **cache_slot) +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); php_http_message_object_prophandler_t *handler; + zend_string *member_name = zval_get_string(member); PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - if ((handler = php_http_message_object_get_prophandler(member))) { + if ((handler = php_http_message_object_get_prophandler(member_name))) { handler->write(obj, value); } else { zend_get_std_object_handlers()->write_property(object, member, value, cache_slot); } - return value; + + zend_string_release(member_name); + PHP_WRITE_PROP_HANDLER_RETURN(value); } -static HashTable *php_http_message_object_get_debug_info(zend_object *object, int *is_temp) +static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + zval tmp; + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); HashTable *props = zend_get_std_object_handlers()->get_properties(object); char *ver_str, *url_str = NULL; size_t ver_len, url_len = 0; - zval tmp; PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - *is_temp = 0; + if (is_temp) { + *is_temp = 0; + } #define UPDATE_PROP(name_str, action_with_tmp) \ do { \ @@@ -1028,10 -1012,10 +1032,10 @@@ return props; } -static HashTable *php_http_message_object_get_gc(zend_object *object, zval **table, int *n) +static HashTable *php_http_message_object_get_gc(zval *object, zval **table, int *n) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); - HashTable *props = object->handlers->get_properties(object); + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); + HashTable *props = Z_OBJPROP_P(object); uint32_t count = 2 + zend_hash_num_elements(props); zval *val; @@@ -1054,6 -1038,30 +1058,6 @@@ return NULL; } -static int php_http_message_object_cast(zend_object *object, zval *return_value, int type) -{ - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); - char *string; - size_t length; - - switch (type) { - case IS_STRING: - PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - php_http_message_to_string(obj->message, &string, &length); - if (string) { - RETVAL_STR(php_http_cs2zs(string, length)); - } else { - RETVAL_EMPTY_STRING(); - } - return SUCCESS; - case _IS_BOOL: - RETVAL_TRUE; - return SUCCESS; - default: - return FAILURE; - } -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___construct, 0, 0, 0) ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, greedy) @@@ -1691,8 -1699,6 +1695,8 @@@ static PHP_METHOD(HttpMessage, getParen RETVAL_OBJECT(&obj->parent->zo, 1); } +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0) +ZEND_END_ARG_INFO(); ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toString, 0, 0, 0) ZEND_ARG_INFO(0, include_parent) ZEND_END_ARG_INFO(); @@@ -1758,6 -1764,58 +1762,6 @@@ static PHP_METHOD(HttpMessage, toCallba } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -static PHP_METHOD(HttpMessage, __serialize) -{ - zend_ulong num_index; - zend_string *str_index; - zend_property_info *pi; - php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - HashTable *props = php_http_message_object_get_debug_info(&obj->zo, NULL); - - zend_parse_parameters_none(); - - array_init(return_value); - - ZEND_HASH_FOREACH_KEY_PTR(&obj->zo.ce->properties_info, num_index, str_index, pi) - { - (void)num_index; - zval *val; - if (str_index && (val = zend_hash_find_ind(props, pi->name))) { - Z_TRY_ADDREF_P(val); - zend_hash_update(Z_ARRVAL_P(return_value), str_index, val); - } - } - ZEND_HASH_FOREACH_END(); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -static PHP_METHOD(HttpMessage, __unserialize) -{ - HashTable *arr; - zend_string *key; - zval *val; - php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr), invalid_arg, return); - - PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - - ZEND_HASH_FOREACH_STR_KEY_VAL(arr, key, val) - { - php_http_message_object_prophandler_t *ph = php_http_message_object_get_prophandler(key); - if (ph) { - ph->write(obj, val); - } else { - zend_update_property_ex(php_http_message_class_entry, &obj->zo, key, val); - } - } - ZEND_HASH_FOREACH_END(); -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, serialize) @@@ -1912,7 -1970,7 +1916,7 @@@ static PHP_METHOD(HttpMessage, splitMul RETURN_OBJ(&php_http_message_object_new_ex(obj->zo.ce, msg)->zo); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_count, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, count) { @@@ -1927,7 -1985,7 +1931,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_rewind, 0, 0, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_rewind, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, rewind) { @@@ -1942,7 -2000,7 +1946,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_valid, 0, 0, _IS_BOOL, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_valid, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, valid) { @@@ -1953,7 -2011,7 +1957,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_next, 0, 0, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_next, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, next) { @@@ -1977,7 -2035,7 +1981,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_key, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_key, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, key) { @@@ -1988,7 -2046,7 +1992,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(ai_HttpMessage_current, 0, 0, http\\Message, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_current, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, current) { @@@ -2001,6 -2059,9 +2005,6 @@@ } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_message_methods[] = { PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpMessage, getBody, ai_HttpMessage_getBody, ZEND_ACC_PUBLIC) @@@ -2037,6 -2098,8 +2041,6 @@@ /* implements Serializable */ PHP_ME(HttpMessage, serialize, ai_HttpMessage_serialize, ZEND_ACC_PUBLIC) PHP_ME(HttpMessage, unserialize, ai_HttpMessage_unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessage, __serialize, ai_HttpMessage___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessage, __unserialize, ai_HttpMessage___unserialize, ZEND_ACC_PUBLIC) /* implements Iterator */ PHP_ME(HttpMessage, rewind, ai_HttpMessage_rewind, ZEND_ACC_PUBLIC) @@@ -2071,14 -2134,11 +2075,14 @@@ PHP_MINIT_FUNCTION(http_message php_http_message_object_handlers.read_property = php_http_message_object_read_prop; php_http_message_object_handlers.write_property = php_http_message_object_write_prop; php_http_message_object_handlers.get_debug_info = php_http_message_object_get_debug_info; +#if PHP_VERSION_ID >= 70400 php_http_message_object_handlers.get_property_ptr_ptr = php_http_message_object_get_prop_ptr; +#else + php_http_message_object_handlers.get_property_ptr_ptr = NULL; +#endif php_http_message_object_handlers.get_gc = php_http_message_object_get_gc; - php_http_message_object_handlers.cast_object = php_http_message_object_cast; - zend_class_implements(php_http_message_class_entry, 3, zend_ce_countable, zend_ce_serializable, zend_ce_iterator); + zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator); zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, php_http_message_object_prophandler_hash_dtor, 1); zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED); diff --combined src/php_http_params.c index 92c1441,f40b89f..75a9e38 --- a/src/php_http_params.c +++ b/src/php_http_params.c @@@ -20,7 -20,7 +20,7 @@@ static php_http_params_opts_t def_opts def_param_sep_ptr, def_arg_sep_ptr, def_val_sep_ptr, - {{0}, {0}, {0}}, + {{0}}, PHP_HTTP_PARAMS_DEFAULT }; @@@ -677,8 -677,9 +677,9 @@@ static void skip_sep(size_t skip, php_h HashTable *php_http_params_parse(HashTable *params, const php_http_params_opts_t *opts) { - php_http_params_state_t state = {{NULL,0}, {NULL,0}, {NULL,0}, {NULL,0}, {NULL,NULL,NULL}, 0, 0}; + php_http_params_state_t state; + memset(&state, 0, sizeof(state)); state.input.str = opts->input.str; state.input.len = opts->input.len; @@@ -1068,16 -1069,16 +1069,16 @@@ PHP_METHOD(HttpParams, __construct { switch (ZEND_NUM_ARGS()) { case 5: - zend_update_property_long(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("flags"), flags); + zend_update_property_long(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), flags); /* no break */ case 4: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), val_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), val_sep); /* no break */ case 3: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), arg_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), arg_sep); /* no break */ case 2: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), param_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), param_sep); /* no break */ } @@@ -1086,7 -1087,7 +1087,7 @@@ case IS_OBJECT: case IS_ARRAY: convert_to_array(zparams); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), zparams); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), zparams); break; default: zs = zval_get_string(zparams); @@@ -1095,15 -1096,15 +1096,15 @@@ php_http_params_opts_t opts = { {zs->val, zs->len}, - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), 0, &tmp)), - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), 0, &tmp)), - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), 0, &tmp)), - {{0}, {0}, {0}}, flags + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &tmp)), + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &tmp)), + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &tmp)), + {{0}}, flags }; array_init(&tmp); php_http_params_parse(Z_ARRVAL(tmp), &opts); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), &tmp); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), &tmp); zval_ptr_dtor(&tmp); php_http_params_separator_free(opts.param); @@@ -1117,7 -1118,7 +1118,7 @@@ zval tmp; array_init(&tmp); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), &tmp); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), &tmp); zval_ptr_dtor(&tmp); } } @@@ -1133,7 -1134,7 +1134,7 @@@ PHP_METHOD(HttpParams, toArray if (SUCCESS != zend_parse_parameters_none()) { return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); RETURN_ZVAL(zparams, 1, 0); } @@@ -1147,23 -1148,23 +1148,23 @@@ PHP_METHOD(HttpParams, toString long flags; php_http_buffer_t buf; - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); convert_to_array_ex(zparams); - flags = zval_get_long(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("flags"), 0, &flags_tmp)); + flags = zval_get_long(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), 0, &flags_tmp)); - zpsep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), 0, &psep_tmp); + zpsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &psep_tmp); if (Z_TYPE_P(zpsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zpsep)))) { psep = zval_get_string(tmp); } else { psep = zval_get_string(zpsep); } - zasep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), 0, &asep_tmp); + zasep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &asep_tmp); if (Z_TYPE_P(zasep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zasep)))) { asep = zval_get_string(tmp); } else { asep = zval_get_string(zasep); } - zvsep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), 0, &vsep_tmp); + zvsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &vsep_tmp); if (Z_TYPE_P(zvsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zvsep)))) { vsep = zval_get_string(tmp); } else { @@@ -1180,7 -1181,7 +1181,7 @@@ RETVAL_STR(php_http_cs2zs(buf.data, buf.used)); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetExists, 0, 1, _IS_BOOL, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetExists, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetExists) @@@ -1192,7 -1193,7 +1193,7 @@@ return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { RETVAL_BOOL(Z_TYPE_P(zparam) != IS_NULL); @@@ -1201,7 -1202,7 +1202,7 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetGet, 0, 1, IS_MIXED, 1) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetGet, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetGet) @@@ -1213,14 -1214,14 +1214,14 @@@ return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { RETVAL_ZVAL(zparam, 1, 0); } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetUnset, 0, 1, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetUnset, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetUnset) @@@ -1232,14 -1233,14 +1233,14 @@@ return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY) { zend_symtable_del(Z_ARRVAL_P(zparams), name); } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetSet, 0, 2, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetSet, 0, 0, 2) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO(); @@@ -1248,14 -1249,14 +1249,14 @@@ PHP_METHOD(HttpParams, offsetSet zend_string *name; zval zparams_tmp, *zparam, *zparams, *nvalue; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S!z", &name, &nvalue)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &nvalue)) { return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); convert_to_array(zparams); - if (name && name->len) { + if (name->len) { if (Z_TYPE_P(nvalue) == IS_ARRAY) { if ((zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { convert_to_array(zparam); @@@ -1289,12 -1290,15 +1290,12 @@@ } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_params_methods[] = { PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_ME(HttpParams, toArray, ai_HttpParams_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, offsetExists, ai_HttpParams_offsetExists, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, offsetUnset, ai_HttpParams_offsetUnset, ZEND_ACC_PUBLIC) @@@ -1344,4 -1348,3 +1345,4 @@@ PHP_MINIT_FUNCTION(http_params * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ + diff --combined src/php_http_querystring.c index 391bccf,06d52c5..b1c6a66 --- a/src/php_http_querystring.c +++ b/src/php_http_querystring.c @@@ -38,7 -38,7 +38,7 @@@ static inline void php_http_querystring array_init(&qa); if (flags & QS_MERGE) { - zval old_tmp, *old = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &old_tmp); + zval old_tmp, *old = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &old_tmp); ZVAL_DEREF(old); if (Z_TYPE_P(old) == IS_ARRAY) { @@@ -47,13 -47,13 +47,13 @@@ } php_http_querystring_update(&qa, params, NULL); - zend_update_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), &qa); + zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), &qa); zval_ptr_dtor(&qa); } static inline void php_http_querystring_str(zval *instance, zval *return_value) { - zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &qa_tmp); + zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@@ -65,7 -65,7 +65,7 @@@ static inline void php_http_querystring_get(zval *instance, int type, char *name, uint32_t name_len, zval *defval, zend_bool del, zval *return_value) { - zval *arrval, qarray_tmp, *qarray = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &qarray_tmp); + zval *arrval, qarray_tmp, *qarray = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qarray_tmp); ZVAL_DEREF(qarray); if ((Z_TYPE_P(qarray) == IS_ARRAY) && (arrval = zend_symtable_str_find(Z_ARRVAL_P(qarray), name, name_len))) { @@@ -98,7 -98,7 +98,7 @@@ ZEND_RESULT_CODE php_http_querystring_x zval *entry; zend_string *xkey, *xstr; php_http_arrkey_t key; - + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(src), key.h, key.key, entry) { if (key.key) { @@@ -107,7 -107,7 +107,7 @@@ return FAILURE; } } - + if (Z_TYPE_P(entry) == IS_STRING) { if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(Z_STRVAL_P(entry), Z_STRLEN_P(entry), &xstr, oe, ie)) { if (key.key) { @@@ -123,7 -123,7 +123,7 @@@ } } else if (Z_TYPE_P(entry) == IS_ARRAY) { zval subarray; - + array_init(&subarray); if (key.key) { add_assoc_zval_ex(dst, xkey->val, xkey->len, &subarray); @@@ -137,7 -137,7 +137,7 @@@ return FAILURE; } } - + if (key.key) { zend_string_release(xkey); } @@@ -254,7 -254,7 +254,7 @@@ ZEND_RESULT_CODE php_http_querystring_u /* squeeze the hash out of the zval */ if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry)) { - zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(params), ZEND_STRL("queryArray"), 0, &qa_tmp); + zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); convert_to_array(qa); @@@ -357,7 -357,7 +357,7 @@@ PHP_METHOD(HttpQueryString, __construct { zval *params = NULL; zend_error_handling zeh; - + php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z", ¶ms), invalid_arg, return); zend_replace_error_handling(EH_THROW, php_http_get_exception_bad_querystring_class_entry(), &zeh); @@@ -378,13 -378,12 +378,13 @@@ PHP_METHOD(HttpQueryString, getGlobalIn if (Z_TYPE_P(instance) == IS_OBJECT) { RETVAL_ZVAL(instance, 1, 0); } else if ((_GET = php_http_env_get_superglobal(ZEND_STRL("_GET")))) { - zval *qa; - zend_string *qa_str = zend_string_init(ZEND_STRL("queryArray"), 0); + zval tmp, *qa; ZVAL_OBJ(return_value, php_http_querystring_object_new(php_http_querystring_class_entry)); - qa = Z_OBJ_HT_P(return_value)->get_property_ptr_ptr(Z_OBJ_P(return_value), qa_str, BP_VAR_RW, NULL); - zend_string_release(qa_str); + + ZVAL_STRING(&tmp, "queryArray"); + qa = Z_OBJ_HT_P(return_value)->get_property_ptr_ptr(return_value, &tmp, BP_VAR_RW, NULL); + zval_ptr_dtor(&tmp); ZVAL_NEW_REF(_GET, _GET); ZVAL_COPY(qa, _GET); @@@ -396,7 -395,7 +396,7 @@@ } -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, Traversable, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, getIterator) { @@@ -404,10 -403,10 +404,10 @@@ php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); object_init_ex(return_value, spl_ce_RecursiveArrayIterator); - zend_call_method_with_1_params(Z_OBJ_P(return_value), spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa); + zend_call_method_with_1_params(return_value, spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa); } ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toString, 0, 0, 0) @@@ -430,7 -429,7 +430,7 @@@ PHP_METHOD(HttpQueryString, toArray return; } - zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp); + zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &zqa_tmp); RETURN_ZVAL(zqa, 1, 0); } @@@ -447,7 -446,7 +447,7 @@@ PHP_METHOD(HttpQueryString, get zend_long type = 0; zend_bool del = 0; zval *ztype = NULL, *defval = NULL; - + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|szzb", &name_str, &name_len, &ztype, &defval, &del)) { if (name_str && name_len) { if (ztype) { @@@ -455,7 -454,7 +455,7 @@@ type = Z_LVAL_P(ztype); } else if(Z_TYPE_P(ztype) == IS_STRING) { switch (Z_STRVAL_P(ztype)[0]) { - case 'B': + case 'B': case 'b': type = PHP_HTTP_QUERYSTRING_TYPE_BOOL; break; case 'L': case 'l': @@@ -464,7 -463,7 +464,7 @@@ case 'd': case 'D': case 'F': - case 'f': type = PHP_HTTP_QUERYSTRING_TYPE_FLOAT; break; + case 'f': type = PHP_HTTP_QUERYSTRING_TYPE_FLOAT; break; case 'S': case 's': type = PHP_HTTP_QUERYSTRING_TYPE_STRING; break; case 'A': @@@ -487,11 -486,11 +487,11 @@@ ZEND_END_ARG_INFO() PHP_METHOD(HttpQueryString, set) { zval *params; - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", ¶ms)) { return; } - + php_http_querystring_set(getThis(), params, QS_MERGE); RETVAL_ZVAL(getThis(), 1, 0); } @@@ -505,11 -504,11 +505,11 @@@ PHP_METHOD(HttpQueryString, mod zend_error_handling zeh; php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", ¶ms), invalid_arg, return); - + zend_replace_error_handling(EH_THROW, php_http_get_exception_bad_querystring_class_entry(), &zeh); - ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(Z_OBJ_P(instance))); + ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(instance)); /* make sure we do not inherit the reference to _GET */ - SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), Z_OBJ_P(return_value), ZEND_STRL("queryArray"), 0, &qa_tmp)); + SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), return_value, ZEND_STRL("queryArray"), 0, &qa_tmp)); php_http_querystring_set(return_value, params, QS_MERGE); zend_restore_error_handling(&zeh); } @@@ -551,7 -550,7 +551,7 @@@ PHP_METHOD(HttpQueryString, xlate php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &ie, &ie_len, &oe, &oe_len), invalid_arg, return); array_init(&na); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); convert_to_array(qa); @@@ -562,11 -561,34 +562,11 @@@ php_http_querystring_set(getThis(), &na, 0); RETVAL_ZVAL(getThis(), 1, 0); - + zval_ptr_dtor(&na); } #endif /* HAVE_ICONV */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpQueryString, __serialize) -{ - zval *zqa, zqa_tmp; - - zend_parse_parameters_none(); - - zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp); - RETURN_ZVAL(zqa, 1, 0); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpQueryString, __unserialize) -{ - zval *qa; - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a", &qa), invalid_arg, return); - php_http_querystring_set(getThis(), qa, 0); -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_serialize, 0, 0, 0) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, serialize) @@@ -583,7 -605,7 +583,7 @@@ ZEND_END_ARG_INFO() PHP_METHOD(HttpQueryString, unserialize) { zval *serialized; - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", &serialized)) { return; } @@@ -595,8 -617,8 +595,8 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetGet, 0, 1, IS_MIXED, 1) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetGet) { @@@ -606,8 -628,8 +606,8 @@@ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) { return; } - + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); + - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@@ -617,15 -639,15 +617,15 @@@ } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetSet, 0, 2, IS_VOID, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2) + ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetSet) { zend_string *offset; zval *value, param, znull; - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &offset, &value)) { return; } @@@ -642,8 -664,8 +642,8 @@@ zval_ptr_dtor(¶m); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetExists, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetExists) { @@@ -653,8 -675,8 +653,8 @@@ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) { return; } - + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); + - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@@ -665,14 -687,14 +665,14 @@@ RETURN_FALSE; } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetUnset) { zend_string *offset; zval param, znull; - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) { return; } @@@ -684,12 -706,15 +684,12 @@@ zval_ptr_dtor(¶m); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_querystring_methods[] = { PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_ME(HttpQueryString, toArray, ai_HttpQueryString_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, get, ai_HttpQueryString_get, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, set, ai_HttpQueryString_set, ZEND_ACC_PUBLIC) @@@ -712,6 -737,8 +712,6 @@@ /* Implements Serializable */ PHP_ME(HttpQueryString, serialize, ai_HttpQueryString_serialize, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, unserialize, ai_HttpQueryString_unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpQueryString, __serialize, ai_HttpQueryString___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpQueryString, __unserialize, ai_HttpQueryString___unserialize, ZEND_ACC_PUBLIC) /* Implements ArrayAccess */ PHP_ME(HttpQueryString, offsetGet, ai_HttpQueryString_offsetGet, ZEND_ACC_PUBLIC) diff --combined src/php_http_url.c index 24a13ff,943a436..32bae58 --- a/src/php_http_url.c +++ b/src/php_http_url.c @@@ -535,7 -535,7 +535,7 @@@ HashTable *php_http_url_to_struct(cons if (!strct || Z_TYPE_P(strct) == IS_ARRAY) { \ zend_hash_str_update(ht, part, lenof(part), &tmp); \ } else { \ - zend_update_property(Z_OBJCE_P(strct), Z_OBJ_P(strct), part, lenof(part), &tmp); \ + zend_update_property(Z_OBJCE_P(strct), strct, part, lenof(part), &tmp); \ zval_ptr_dtor(&tmp); \ } @@@ -1021,7 -1021,7 +1021,7 @@@ static ZEND_RESULT_CODE parse_uidn_2003 # endif efree(uhost_str); - if (error > U_ZERO_ERROR) { + if (rc > U_ZERO_ERROR) { goto error; } @@@ -1984,7 -1984,7 +1984,7 @@@ PHP_METHOD(HttpUrl, mod if ((old_purl = php_http_url_from_struct(HASH_OF(getThis())))) { php_http_url_t *res_purl; - ZVAL_OBJ(return_value, zend_objects_clone_obj(Z_OBJ_P(getThis()))); + ZVAL_OBJ(return_value, zend_objects_clone_obj(getThis())); res_purl = php_http_url_mod(old_purl, new_purl, flags); php_http_url_to_struct(res_purl, return_value); @@@ -2034,11 -2034,14 +2034,11 @@@ PHP_METHOD(HttpUrl, toArray php_http_url_free(&purl); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpUrl___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_url_methods[] = { PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, toArray, ai_HttpUrl_toArray, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; @@@ -2108,4 -2111,3 +2108,3 @@@ PHP_MINIT_FUNCTION(http_url * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ - diff --combined tests/client002.phpt index 6f01a44,d020f16..5b0b2aa --- a/tests/client002.phpt +++ b/tests/client002.phpt @@@ -14,10 -14,13 +14,12 @@@ echo "Test\n" class Observer implements SplObserver { - #[ReturnTypeWillChange] function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) { echo "P"; - if ($progress->info !== "prepare" && $client->getProgressInfo($request) != $progress) { - var_dump($progress); + /* fence against buggy infof() calls in some curl versions */ + $compare = $client->getProgressInfo($request); + if ($progress->info !== "prepare" && $compare && $compare != $progress) { + var_dump($progress, $compare); } } } diff --combined tests/client012.phpt index bb599db,5dd1513..0e72628 --- a/tests/client012.phpt +++ b/tests/client012.phpt @@@ -6,6 -6,8 +6,8 @@@ include "skipif.inc" skip_online_test(); skip_client_test(); skip_curl_test("7.34.0"); + if (strpos(http\Client\Curl\Versions\SSL, "SecureTransport") !== false) + die("skip SecureTransport\n"); ?> --FILE-- attach($observer = new class implements SplObserver { public $data = []; - - #[ReturnTypeWillChange] function update(SplSubject $client, $req = null, $progress = null) { $ti = $client->getTransferInfo($req); if (isset($ti->tls_session["internals"])) { @@@ -43,7 -47,9 +45,9 @@@ switch ($client->getTransferInfo($req)- case "openssl": case "gnutls": if (count($observer->data) < 1) { - die("failed count(ssl.internals) >= 1\n"); + printf("%s: failed count(ssl.internals) >= 1\n", $client->getTransferInfo($req)->tls_session["backend"]); + var_dump($observer); + exit; } break; default: diff --combined tests/client024.phpt index 27a68b4,4e8fe2f..39949b0 --- a/tests/client024.phpt +++ b/tests/client024.phpt @@@ -1,12 -1,14 +1,14 @@@ --TEST-- client deprecated methods --SKIPIF-- - --FILE-- - enablePipelining(false) --EXPECTF-- Test - Deprecated: Function http\Client::enableEvents() is deprecated in %sclient024.php on line %d -Deprecated: Method http\Client::enableEvents() is deprecated in %sclient024.php on line %d ++Deprecated: %s http\Client::enableEvents() is deprecated in %sclient024.php on line %d - Deprecated: Function http\Client::enablePipelining() is deprecated in %sclient024.php on line %d -Deprecated: Method http\Client::enablePipelining() is deprecated in %sclient024.php on line %d ++Deprecated: %s http\Client::enablePipelining() is deprecated in %sclient024.php on line %d ===DONE===