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/?a=commitdiff_plain;h=e3976774f27b4129cbfd7d227aaa7e177f1b735c;p=m6w6%2Fext-http Backport v4 updates --- e3976774f27b4129cbfd7d227aaa7e177f1b735c diff --cc 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 diff --cc 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 --cc src/php_http_client.c index 9551dd0,a272fa4..d2f6204 --- a/src/php_http_client.c +++ b/src/php_http_client.c @@@ -633,11 -646,10 +647,10 @@@ 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)); diff --cc src/php_http_header.c index 4c9a702,c475a81..7044c21 --- a/src/php_http_header.c +++ b/src/php_http_header.c @@@ -327,13 -362,13 +327,13 @@@ 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]); } diff --cc src/php_http_message.c index 371ecb7,cd01757..2014aac --- a/src/php_http_message.c +++ b/src/php_http_message.c @@@ -956,9 -937,12 +958,11 @@@ static HashTable *php_http_message_obje 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 { \ diff --cc src/php_http_querystring.c index 391bccf,06d52c5..b1c6a66 --- a/src/php_http_querystring.c +++ b/src/php_http_querystring.c @@@ -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); } @@@ -606,8 -628,8 +606,8 @@@ PHP_METHOD(HttpQueryString, offsetGet 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) { @@@ -653,8 -675,8 +653,8 @@@ PHP_METHOD(HttpQueryString, offsetExist 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) { diff --cc 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 --cc tests/client024.phpt index 27a68b4,4e8fe2f..39949b0 --- a/tests/client024.phpt +++ b/tests/client024.phpt @@@ -19,7 -21,7 +21,7 @@@ $client->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===