From 877ce69b3077ed1e2bb229c05b7b510f3567696d Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 11 Feb 2019 10:20:28 -0800 Subject: [PATCH 01/16] Fix 32-bit build --- win32/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/signal.c b/win32/signal.c index d682c42fbe0..8ae116d93da 100644 --- a/win32/signal.c +++ b/win32/signal.c @@ -72,7 +72,7 @@ PHP_WINUTIL_API void php_win32_signal_ctrl_handler_shutdown(void) ZVAL_UNDEF(&ctrl_handler); }/*}}}*/ -static BOOL php_win32_signal_system_ctrl_handler(DWORD evt) +static BOOL WINAPI php_win32_signal_system_ctrl_handler(DWORD evt) {/*{{{*/ if (CTRL_C_EVENT != evt && CTRL_BREAK_EVENT != evt) { return FALSE; From 6ac8b0a783b20ba28667267b0b09a682bcb129e3 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 11 Feb 2019 19:27:27 +0100 Subject: [PATCH 02/16] Deprecate ext/wddx Cf. . --- NEWS | 3 +++ UPGRADING | 3 +++ ext/wddx/tests/001-64bit.phpt | 3 ++- ext/wddx/tests/001.phpt | 3 ++- ext/wddx/tests/002.phpt | 7 ++++++- ext/wddx/tests/003.phpt | 3 ++- ext/wddx/tests/bug27287.phpt | 5 ++++- ext/wddx/tests/bug34306.phpt | 3 ++- ext/wddx/tests/bug35410.phpt | 3 ++- ext/wddx/tests/bug35410_64bit.phpt | 3 ++- ext/wddx/tests/bug37569.phpt | 2 ++ ext/wddx/tests/bug37587.phpt | 3 ++- ext/wddx/tests/bug41283.phpt | 5 ++++- ext/wddx/tests/bug41527.phpt | 5 ++++- ext/wddx/tests/bug45901.phpt | 2 ++ ext/wddx/tests/bug48562.phpt | 4 ++++ ext/wddx/tests/bug52468.phpt | 5 ++++- ext/wddx/tests/bug70661.phpt | 3 ++- ext/wddx/tests/bug71335.phpt | 1 + ext/wddx/tests/bug71587.phpt | 3 ++- ext/wddx/tests/bug72142.phpt | 5 ++++- ext/wddx/tests/bug72340.phpt | 3 ++- ext/wddx/tests/bug72564.phpt | 13 ++++++++++++- ext/wddx/tests/bug72749.phpt | 3 ++- ext/wddx/tests/bug72750.phpt | 3 ++- ext/wddx/tests/bug72790.phpt | 3 ++- ext/wddx/tests/bug72799.phpt | 3 ++- ext/wddx/tests/bug72860.phpt | 3 ++- ext/wddx/tests/bug73065.phpt | 11 ++++++++++- ext/wddx/tests/bug73173.phpt | 3 ++- ext/wddx/tests/bug73331.phpt | 2 ++ ext/wddx/tests/bug73631.phpt | 3 ++- ext/wddx/tests/bug73793.phpt | 3 ++- ext/wddx/tests/bug73831.phpt | 2 ++ ext/wddx/tests/bug74145.phpt | 3 ++- ext/wddx/tests/bug75055.phpt | 4 +++- ext/wddx/wddx.c | 12 ++++++------ 37 files changed, 114 insertions(+), 34 deletions(-) diff --git a/NEWS b/NEWS index 46ed5455026..2a76ca3c2ad 100644 --- a/NEWS +++ b/NEWS @@ -92,4 +92,7 @@ PHP NEWS - Tidy: . Added TIDY_TAG_* constants for HTML5 elements. (cmb) +- WDDX: + . Deprecated the WDDX extension. (cmb) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/UPGRADING b/UPGRADING index 566a390cbfc..e33e75991c3 100644 --- a/UPGRADING +++ b/UPGRADING @@ -241,6 +241,9 @@ PHP 7.4 UPGRADE NOTES possible, but unserialization yielded unusable objects. . The @param notation can now also be used to denote SQL query parameters. +- WDDX: + . The WDDX extension has been deprecated. + - Zip: . The bundled libzip library has been removed. A system libzip >= 0.11 is now necessary to build the extension. diff --git a/ext/wddx/tests/001-64bit.phpt b/ext/wddx/tests/001-64bit.phpt index 78b1dc9994b..7869c48e1dd 100644 --- a/ext/wddx/tests/001-64bit.phpt +++ b/ext/wddx/tests/001-64bit.phpt @@ -10,7 +10,8 @@ precision=14 $path = dirname(__FILE__); var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml"))); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(11) { ["aNull"]=> NULL diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt index e1aafd0ab05..ebe3af60afe 100644 --- a/ext/wddx/tests/001.phpt +++ b/ext/wddx/tests/001.phpt @@ -10,7 +10,8 @@ precision=14 $path = dirname(__FILE__); var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml"))); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(11) { ["aNull"]=> NULL diff --git a/ext/wddx/tests/002.phpt b/ext/wddx/tests/002.phpt index 692bfa85c60..1783cbea7b4 100644 --- a/ext/wddx/tests/002.phpt +++ b/ext/wddx/tests/002.phpt @@ -17,5 +17,10 @@ precision=14 wddx_add_vars($pkt, 'var1', 'var2', array('var3', 'var4')); echo wddx_packet_end($pkt); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_packet_start() is deprecated in %s on line %d + +Deprecated: Function wddx_add_vars() is deprecated in %s on line %d + +Deprecated: Function wddx_packet_end() is deprecated in %s on line %d
TEST comment
some string756
diff --git a/ext/wddx/tests/003.phpt b/ext/wddx/tests/003.phpt index 3240e43e92c..999d63724a5 100644 --- a/ext/wddx/tests/003.phpt +++ b/ext/wddx/tests/003.phpt @@ -13,7 +13,8 @@ precision=14 var_dump(wddx_deserialize($fp)); fclose($fp); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(4) { ["var1"]=> NULL diff --git a/ext/wddx/tests/bug27287.phpt b/ext/wddx/tests/bug27287.phpt index f709b71a991..823aa10f3d0 100644 --- a/ext/wddx/tests/bug27287.phpt +++ b/ext/wddx/tests/bug27287.phpt @@ -16,5 +16,8 @@ Bug #27287 (segfault with deserializing object data) echo "OK\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d OK diff --git a/ext/wddx/tests/bug34306.phpt b/ext/wddx/tests/bug34306.phpt index 5f1a0df72f1..a7247d5c07c 100644 --- a/ext/wddx/tests/bug34306.phpt +++ b/ext/wddx/tests/bug34306.phpt @@ -10,5 +10,6 @@ $buf = wddx_serialize_value($var, 'name'); echo "OK\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d OK diff --git a/ext/wddx/tests/bug35410.phpt b/ext/wddx/tests/bug35410.phpt index 27655c7bdc7..2100c8a38e4 100644 --- a/ext/wddx/tests/bug35410.phpt +++ b/ext/wddx/tests/bug35410.phpt @@ -50,7 +50,8 @@ WDX; var_dump(wddx_deserialize($wddx)); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["content_queries"]=> array(1) { diff --git a/ext/wddx/tests/bug35410_64bit.phpt b/ext/wddx/tests/bug35410_64bit.phpt index 8514170fcbf..ffe4e081888 100644 --- a/ext/wddx/tests/bug35410_64bit.phpt +++ b/ext/wddx/tests/bug35410_64bit.phpt @@ -50,7 +50,8 @@ WDX; var_dump(wddx_deserialize($wddx)); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["content_queries"]=> array(1) { diff --git a/ext/wddx/tests/bug37569.phpt b/ext/wddx/tests/bug37569.phpt index 45cd68a80ba..7099f9669a1 100644 --- a/ext/wddx/tests/bug37569.phpt +++ b/ext/wddx/tests/bug37569.phpt @@ -2,6 +2,8 @@ Bug #37569 (WDDX incorrectly encodes high-ascii characters) --SKIPIF-- +--INI-- +error_reporting=E_ALL & ~E_DEPRECATED --FILE-- ===DONE=== ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { [0]=> array(1) { diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt index af716d1893f..4a1f92b991f 100644 --- a/ext/wddx/tests/bug41283.phpt +++ b/ext/wddx/tests/bug41283.phpt @@ -10,7 +10,10 @@ $data = array( var_dump(wddx_deserialize(wddx_serialize_vars('data'))); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["data"]=> array(1) { diff --git a/ext/wddx/tests/bug41527.phpt b/ext/wddx/tests/bug41527.phpt index 447bfc34d1c..329f732a197 100644 --- a/ext/wddx/tests/bug41527.phpt +++ b/ext/wddx/tests/bug41527.phpt @@ -8,7 +8,10 @@ $data = array('01' => 'Zero', '+1' => 'Plus sign', ' 1' => 'Space'); var_dump(wddx_deserialize(wddx_serialize_vars('data'))); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["data"]=> array(3) { diff --git a/ext/wddx/tests/bug45901.phpt b/ext/wddx/tests/bug45901.phpt index 67138560555..c89b230eb95 100644 --- a/ext/wddx/tests/bug45901.phpt +++ b/ext/wddx/tests/bug45901.phpt @@ -14,6 +14,8 @@ echo wddx_serialize_value($xml, 'Variables') . "\n"; echo "DONE"; ?> --EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %sbug45901.php on line %d + Warning: wddx_serialize_value(): Class SimpleXMLElement can not be serialized in %sbug45901.php on line %d
Variables
DONE diff --git a/ext/wddx/tests/bug48562.phpt b/ext/wddx/tests/bug48562.phpt index ee9f271d916..10a2b656609 100644 --- a/ext/wddx/tests/bug48562.phpt +++ b/ext/wddx/tests/bug48562.phpt @@ -29,6 +29,10 @@ var_dump(wddx_serialize_vars($a)); ?> --EXPECTF-- +Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d + Warning: wddx_serialize_vars(): recursion detected in %s on line %d string(78) "
" + +Deprecated: Function wddx_serialize_vars() is deprecated in %s on line %d string(120) "
bar" diff --git a/ext/wddx/tests/bug52468.phpt b/ext/wddx/tests/bug52468.phpt index b0d8eb329d0..1fd3df9e4ad 100644 --- a/ext/wddx/tests/bug52468.phpt +++ b/ext/wddx/tests/bug52468.phpt @@ -15,11 +15,14 @@ print_r(wddx_deserialize($message)); print_r(wddx_deserialize($message)); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d Array ( [handle] => 0 ) + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d Array ( [handle] => 0 diff --git a/ext/wddx/tests/bug70661.phpt b/ext/wddx/tests/bug70661.phpt index b7fcb1b3b8d..60683d57195 100644 --- a/ext/wddx/tests/bug70661.phpt +++ b/ext/wddx/tests/bug70661.phpt @@ -53,7 +53,8 @@ function ptr2str($ptr) } ?> DONE ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { [0]=> array(1) { diff --git a/ext/wddx/tests/bug71335.phpt b/ext/wddx/tests/bug71335.phpt index 57a7f14f810..9fdbb258226 100644 --- a/ext/wddx/tests/bug71335.phpt +++ b/ext/wddx/tests/bug71335.phpt @@ -26,6 +26,7 @@ var_dump($d); ?> DONE --EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d object(stdClass)#%d (1) { ["php_class_name"]=> string(8) "stdClass" diff --git a/ext/wddx/tests/bug71587.phpt b/ext/wddx/tests/bug71587.phpt index ce46d5ec7e6..bb7c00b5868 100644 --- a/ext/wddx/tests/bug71587.phpt +++ b/ext/wddx/tests/bug71587.phpt @@ -29,7 +29,8 @@ foreach($wddx as $k=>$v) ?> DONE ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(2) { [0]=> string(8) "manhluat" diff --git a/ext/wddx/tests/bug72142.phpt b/ext/wddx/tests/bug72142.phpt index 0c93ecc9705..955af38131f 100644 --- a/ext/wddx/tests/bug72142.phpt +++ b/ext/wddx/tests/bug72142.phpt @@ -10,6 +10,9 @@ var_dump($wddx); var_dump(wddx_deserialize($wddx)); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d string(301) "
</comment></header><data><struct><var name="php_class_name"><string>stdClass</string></var></struct></data></wddxPacket>
" + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d string(0) "" diff --git a/ext/wddx/tests/bug72340.phpt b/ext/wddx/tests/bug72340.phpt index 8d694ca52e7..7597a2f4795 100644 --- a/ext/wddx/tests/bug72340.phpt +++ b/ext/wddx/tests/bug72340.phpt @@ -19,6 +19,7 @@ EOF; $array = wddx_deserialize($xml); var_dump($array); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(0) { } diff --git a/ext/wddx/tests/bug72564.phpt b/ext/wddx/tests/bug72564.phpt index 4711ef8b40a..a1037a8662d 100644 --- a/ext/wddx/tests/bug72564.phpt +++ b/ext/wddx/tests/bug72564.phpt @@ -10,11 +10,22 @@ Bug #72564: wddx deserialization of boolean } ?> Done ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d string(84) "
" bool(true) + +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d string(85) "
" bool(false) + +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d string(68) "
" NULL Done diff --git a/ext/wddx/tests/bug72749.phpt b/ext/wddx/tests/bug72749.phpt index ee17d0f2295..49a7af9c733 100644 --- a/ext/wddx/tests/bug72749.phpt +++ b/ext/wddx/tests/bug72749.phpt @@ -26,7 +26,8 @@ XML; $array = wddx_deserialize($xml); var_dump($array); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["aDateTime3"]=> string(24) "2 diff --git a/ext/wddx/tests/bug72750.phpt b/ext/wddx/tests/bug72750.phpt index b88a1e0a9ef..a789900a604 100644 --- a/ext/wddx/tests/bug72750.phpt +++ b/ext/wddx/tests/bug72750.phpt @@ -27,7 +27,8 @@ XML; $array = wddx_deserialize($xml); var_dump($array); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["aBinary"]=> string(9) "µ‰¥¹…ÉFF" diff --git a/ext/wddx/tests/bug72790.phpt b/ext/wddx/tests/bug72790.phpt index 08987868248..335cee0d832 100644 --- a/ext/wddx/tests/bug72790.phpt +++ b/ext/wddx/tests/bug72790.phpt @@ -31,5 +31,6 @@ XML; $array = wddx_deserialize($xml); var_dump($array); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d NULL diff --git a/ext/wddx/tests/bug72799.phpt b/ext/wddx/tests/bug72799.phpt index c117279c2c5..a5fea7a4da7 100644 --- a/ext/wddx/tests/bug72799.phpt +++ b/ext/wddx/tests/bug72799.phpt @@ -24,5 +24,6 @@ XML; $array = wddx_deserialize($xml); var_dump($array); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d NULL diff --git a/ext/wddx/tests/bug72860.phpt b/ext/wddx/tests/bug72860.phpt index a35f993b07c..831811b8423 100644 --- a/ext/wddx/tests/bug72860.phpt +++ b/ext/wddx/tests/bug72860.phpt @@ -22,6 +22,7 @@ XML; var_dump(wddx_deserialize($xml)); ?> DONE ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d NULL DONE diff --git a/ext/wddx/tests/bug73065.phpt b/ext/wddx/tests/bug73065.phpt index d7c7868946d..5481b88fd61 100644 --- a/ext/wddx/tests/bug73065.phpt +++ b/ext/wddx/tests/bug73065.phpt @@ -81,18 +81,27 @@ for($i=1;$i<=5;$i++) { } ?> DONE ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(0) { } + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(0) { } + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(0) { } + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { [0]=> array(0) { } } + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(0) { } DONE diff --git a/ext/wddx/tests/bug73173.phpt b/ext/wddx/tests/bug73173.phpt index 00fe56e4b0d..d9e6644b8ba 100644 --- a/ext/wddx/tests/bug73173.phpt +++ b/ext/wddx/tests/bug73173.phpt @@ -21,5 +21,6 @@ XML; var_dump(wddx_deserialize($xml)); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d NULL diff --git a/ext/wddx/tests/bug73331.phpt b/ext/wddx/tests/bug73331.phpt index 13f3747d3e5..3ee2e596efb 100644 --- a/ext/wddx/tests/bug73331.phpt +++ b/ext/wddx/tests/bug73331.phpt @@ -9,5 +9,7 @@ $wddx = "
5.1])); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_serialize_value() is deprecated in %s on line %d string(120) "
5.1" ===DONE=== diff --git a/ext/wddx/tests/bug73831.phpt b/ext/wddx/tests/bug73831.phpt index 0f8b8b12649..dc25f3c092c 100644 --- a/ext/wddx/tests/bug73831.phpt +++ b/ext/wddx/tests/bug73831.phpt @@ -19,5 +19,7 @@ try { } catch(Error $e) { echo $e->getMessage(); } ?> --EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d + Warning: wddx_deserialize(): Class throwable can not be instantiated in %sbug73831.php on line %d Cannot instantiate interface Throwable diff --git a/ext/wddx/tests/bug74145.phpt b/ext/wddx/tests/bug74145.phpt index a7009035bff..1daa189accb 100644 --- a/ext/wddx/tests/bug74145.phpt +++ b/ext/wddx/tests/bug74145.phpt @@ -11,6 +11,7 @@ $wddx = wddx_deserialize($data); var_dump($wddx); ?> DONE ---EXPECT-- +--EXPECTF-- +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d NULL DONE diff --git a/ext/wddx/tests/bug75055.phpt b/ext/wddx/tests/bug75055.phpt index 2956284d221..affad3d4211 100644 --- a/ext/wddx/tests/bug75055.phpt +++ b/ext/wddx/tests/bug75055.phpt @@ -12,8 +12,10 @@ print strlen($wddx_str) . " bytes read.\n"; var_dump(wddx_deserialize($wddx_str)); ?> ---EXPECT-- +--EXPECTF-- 323 bytes read. + +Deprecated: Function wddx_deserialize() is deprecated in %s on line %d array(1) { ["aDateTime"]=> string(12) "frONt of 0 0" diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 658ec1b6479..b32623f3d81 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -130,12 +130,12 @@ ZEND_END_ARG_INFO() /* {{{ wddx_functions[] */ static const zend_function_entry wddx_functions[] = { - PHP_FE(wddx_serialize_value, arginfo_wddx_serialize_value) - PHP_FE(wddx_serialize_vars, arginfo_wddx_serialize_vars) - PHP_FE(wddx_packet_start, arginfo_wddx_serialize_start) - PHP_FE(wddx_packet_end, arginfo_wddx_packet_end) - PHP_FE(wddx_add_vars, arginfo_wddx_add_vars) - PHP_FE(wddx_deserialize, arginfo_wddx_deserialize) + PHP_DEP_FE(wddx_serialize_value, arginfo_wddx_serialize_value) + PHP_DEP_FE(wddx_serialize_vars, arginfo_wddx_serialize_vars) + PHP_DEP_FE(wddx_packet_start, arginfo_wddx_serialize_start) + PHP_DEP_FE(wddx_packet_end, arginfo_wddx_packet_end) + PHP_DEP_FE(wddx_add_vars, arginfo_wddx_add_vars) + PHP_DEP_FE(wddx_deserialize, arginfo_wddx_deserialize) PHP_FE_END }; /* }}} */ From e74a91862186bba5bb3eacb5b60631bc174b225c Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 11 Feb 2019 22:12:16 -0800 Subject: [PATCH 03/16] Update SDK version for AppVeyor --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index deeccfa066d..126e19d8352 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,7 +16,7 @@ environment: PHP_BUILD_CACHE_BASE_DIR: c:\build-cache PHP_BUILD_OBJ_DIR: c:\obj PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk - PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta1 + PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta2 PHP_BUILD_CRT: vc15 # ext and env setup for tests #MYSQL_TEST_PASSWD: Password12! From 186b5de57537a77e764420119257aa296bdeb627 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 11 Feb 2019 22:28:34 -0800 Subject: [PATCH 04/16] Replace broken binary SDK version --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 126e19d8352..c3ad49c53e4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,7 +16,7 @@ environment: PHP_BUILD_CACHE_BASE_DIR: c:\build-cache PHP_BUILD_OBJ_DIR: c:\obj PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk - PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta2 + PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0beta3 PHP_BUILD_CRT: vc15 # ext and env setup for tests #MYSQL_TEST_PASSWD: Password12! From 9222702633c63254b08466b322266b647ac3e905 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 12 Feb 2019 10:15:16 +0300 Subject: [PATCH 05/16] Avoid dependency on "struct flock" fields order. --- ext/opcache/ZendAccelerator.c | 68 ++++++++++++++++++++------------- ext/opcache/ZendAccelerator.h | 13 ------- ext/opcache/config.m4 | 57 --------------------------- ext/opcache/zend_shared_alloc.c | 21 +++++++--- 4 files changed, 56 insertions(+), 103 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 46a86a31099..601e3af0cff 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -230,11 +230,12 @@ static inline void accel_restart_enter(void) #ifdef ZEND_WIN32 INCREMENT(restart_in); #else -# ifdef _AIX - static FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1); -# else - static const FLOCK_STRUCTURE(restart_in_progress, F_WRLCK, SEEK_SET, 2, 1); -#endif + struct flock restart_in_progress; + + restart_in_progress.l_type = F_WRLCK; + restart_in_progress.l_whence = SEEK_SET; + restart_in_progress.l_start = 2; + restart_in_progress.l_len = 1; if (fcntl(lock_file, F_SETLK, &restart_in_progress) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "RestartC(+1): %s (%d)", strerror(errno), errno); @@ -249,11 +250,12 @@ static inline void accel_restart_leave(void) ZCSG(restart_in_progress) = 0; DECREMENT(restart_in); #else -# ifdef _AIX - static FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1); -# else - static const FLOCK_STRUCTURE(restart_finished, F_UNLCK, SEEK_SET, 2, 1); -# endif + struct flock restart_finished; + + restart_finished.l_type = F_UNLCK; + restart_finished.l_whence = SEEK_SET; + restart_finished.l_start = 2; + restart_finished.l_len = 1; ZCSG(restart_in_progress) = 0; if (fcntl(lock_file, F_SETLK, &restart_finished) == -1) { @@ -266,7 +268,12 @@ static inline int accel_restart_is_active(void) { if (ZCSG(restart_in_progress)) { #ifndef ZEND_WIN32 - FLOCK_STRUCTURE(restart_check, F_WRLCK, SEEK_SET, 2, 1); + struct flock restart_check; + + restart_check.l_type = F_WRLCK; + restart_check.l_whence = SEEK_SET; + restart_check.l_start = 2; + restart_check.l_len = 1; if (fcntl(lock_file, F_GETLK, &restart_check) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "RestartC: %s (%d)", strerror(errno), errno); @@ -291,11 +298,12 @@ static inline int accel_activate_add(void) #ifdef ZEND_WIN32 INCREMENT(mem_usage); #else -# ifdef _AIX - static FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1); -# else - static const FLOCK_STRUCTURE(mem_usage_lock, F_RDLCK, SEEK_SET, 1, 1); -# endif + struct flock mem_usage_lock; + + mem_usage_lock.l_type = F_RDLCK; + mem_usage_lock.l_whence = SEEK_SET; + mem_usage_lock.l_start = 1; + mem_usage_lock.l_len = 1; if (fcntl(lock_file, F_SETLK, &mem_usage_lock) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(+1): %s (%d)", strerror(errno), errno); @@ -314,11 +322,12 @@ static inline void accel_deactivate_sub(void) ZCG(counted) = 0; } #else -# ifdef _AIX - static FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1); -# else - static const FLOCK_STRUCTURE(mem_usage_unlock, F_UNLCK, SEEK_SET, 1, 1); -# endif + struct flock mem_usage_unlock; + + mem_usage_unlock.l_type = F_UNLCK; + mem_usage_unlock.l_whence = SEEK_SET; + mem_usage_unlock.l_start = 1; + mem_usage_unlock.l_len = 1; if (fcntl(lock_file, F_SETLK, &mem_usage_unlock) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC(-1): %s (%d)", strerror(errno), errno); @@ -331,11 +340,12 @@ static inline void accel_unlock_all(void) #ifdef ZEND_WIN32 accel_deactivate_sub(); #else -# ifdef _AIX - static FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0); -# else - static const FLOCK_STRUCTURE(mem_usage_unlock_all, F_UNLCK, SEEK_SET, 0, 0); -# endif + struct flock mem_usage_unlock_all; + + mem_usage_unlock_all.l_type = F_UNLCK; + mem_usage_unlock_all.l_whence = SEEK_SET; + mem_usage_unlock_all.l_start = 0; + mem_usage_unlock_all.l_len = 0; if (fcntl(lock_file, F_SETLK, &mem_usage_unlock_all) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "UnlockAll: %s (%d)", strerror(errno), errno); @@ -730,8 +740,12 @@ static inline int accel_is_inactive(void) return SUCCESS; } #else - FLOCK_STRUCTURE(mem_usage_check, F_WRLCK, SEEK_SET, 1, 1); + struct flock mem_usage_check; + mem_usage_check.l_type = F_WRLCK; + mem_usage_check.l_whence = SEEK_SET; + mem_usage_check.l_start = 1; + mem_usage_check.l_len = 1; mem_usage_check.l_pid = -1; if (fcntl(lock_file, F_GETLK, &mem_usage_check) == -1) { zend_accel_error(ACCEL_LOG_DEBUG, "UpdateC: %s (%d)", strerror(errno), errno); diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 685d9e29cb9..5f195ba3bcf 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -89,19 +89,6 @@ /*** file locking ***/ #ifndef ZEND_WIN32 extern int lock_file; - -# if defined(HAVE_FLOCK_AIX64) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, 0, 0, 0, start, len } -# elif defined(HAVE_FLOCK_BSD) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {start, len, -1, type, whence} -# elif defined(HAVE_FLOCK_LINUX) -# define FLOCK_STRUCTURE(name, type, whence, start, len) \ - struct flock name = {type, whence, start, len} -# else -# error "Don't know how to define struct flock" -# endif #endif #if defined(HAVE_OPCACHE_FILE_CACHE) && defined(ZEND_WIN32) diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index ec14487c123..aa50d561164 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -343,63 +343,6 @@ int main() { msg=yes,msg=no,msg=no) AC_MSG_RESULT([$msg]) -flock_type=unknown -AC_MSG_CHECKING(for struct flock layout) - -if test "$flock_type" = "unknown"; then -AC_TRY_RUN([ - #include - struct flock lock = { 1, 2, 3, 4, 5, 6, 7 }; - int main() { - if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 6 && lock.l_len== 7) { - return 0; - } - return 1; - } -], [ - flock_type=aix64 - AC_DEFINE([HAVE_FLOCK_AIX64], [], [Struct flock is 64-bit AIX-type]) -], []) -fi - -if test "$flock_type" = "unknown"; then -AC_TRY_RUN([ - #include - struct flock lock = { 1, 2, 3, 4, 5 }; - int main() { - if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) { - return 0; - } - return 1; - } -], [ - flock_type=linux - AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) -], []) -fi - -if test "$flock_type" = "unknown"; then -AC_TRY_RUN([ - #include - struct flock lock = { 1, 2, 3, 4, 5 }; - int main() { - if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) { - return 0; - } - return 1; - } -], [ - flock_type=bsd - AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) -], []) -fi - -AC_MSG_RESULT([$flock_type]) - -if test "$flock_type" = "unknown"; then - AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) -fi - PHP_NEW_EXTENSION(opcache, ZendAccelerator.c \ zend_accelerator_blacklist.c \ diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 249d99022a4..f2415feaffc 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -371,15 +371,15 @@ void zend_shared_alloc_safe_unlock(void) } } -#ifndef ZEND_WIN32 -/* name l_type l_whence l_start l_len */ -static FLOCK_STRUCTURE(mem_write_lock, F_WRLCK, SEEK_SET, 0, 1); -static FLOCK_STRUCTURE(mem_write_unlock, F_UNLCK, SEEK_SET, 0, 1); -#endif - void zend_shared_alloc_lock(void) { #ifndef ZEND_WIN32 + struct flock mem_write_lock; + + mem_write_lock.l_type = F_WRLCK; + mem_write_lock.l_whence = SEEK_SET; + mem_write_lock.l_start = 0; + mem_write_lock.l_len = 1; #ifdef ZTS tsrm_mutex_lock(zts_lock); @@ -410,6 +410,15 @@ void zend_shared_alloc_lock(void) void zend_shared_alloc_unlock(void) { +#ifndef ZEND_WIN32 + struct flock mem_write_unlock; + + mem_write_unlock.l_type = F_UNLCK; + mem_write_unlock.l_whence = SEEK_SET; + mem_write_unlock.l_start = 0; + mem_write_unlock.l_len = 1; +#endif + ZCG(locked) = 0; #ifndef ZEND_WIN32 From b6e58dcd2262c30c0657624ca3c372dc90d5a031 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 12 Feb 2019 10:55:05 +0300 Subject: [PATCH 06/16] Fixed bug #77599 (Unbuffered queries; native prepared statements memory leak) --- NEWS | 4 ++++ ext/mysqlnd/mysqlnd_ps.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 8f3e10e09a7..a1fb54f0df5 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte). (Nikita) +- MySQLnd: + . Fixed bug #77599 (Unbuffered queries; native prepared statements memory + leak). (Dmitry) + - OpenSSL: . Fixed bug #77390 (feof might hang on TLS streams in case of fragmented TLS records). (Abyl Valg, Jakub Zelenka) diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index f3fab43f0c0..b2017b9127f 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -851,6 +851,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi MYSQLND_PACKET_ROW * row_packet; MYSQLND_CONN_DATA * conn = result->conn; const MYSQLND_RES_METADATA * const meta = result->meta; + void *checkpoint; DBG_ENTER("mysqlnd_stmt_fetch_row_unbuffered"); @@ -873,6 +874,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi /* Let the row packet fill our buffer and skip additional malloc + memcpy */ row_packet->skip_extraction = stmt && stmt->result_bind? FALSE:TRUE; + checkpoint = result->memory_pool->checkpoint; + mysqlnd_mempool_save_state(result->memory_pool); + /* If we skip rows (stmt == NULL || stmt->result_bind == NULL) we have to result->unbuf->m.free_last_data() before it. The function returns always true. @@ -895,6 +899,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi conn->options->int_and_float_native, conn->stats)) { + mysqlnd_mempool_restore_state(result->memory_pool); + result->memory_pool->checkpoint = checkpoint; DBG_RETURN(FAIL); } @@ -965,6 +971,9 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, const unsi } } + mysqlnd_mempool_restore_state(result->memory_pool); + result->memory_pool->checkpoint = checkpoint; + DBG_INF_FMT("ret=%s fetched_anything=%u", ret == PASS? "PASS":"FAIL", *fetched_anything); DBG_RETURN(ret); } From 7d4de1a77e6d2f96232a68005cdee4866e3eeb58 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 12 Feb 2019 11:21:09 +0300 Subject: [PATCH 07/16] Fixed possible crash --- ext/ffi/ffi.c | 8 +++++++- ext/ffi/tests/042.phpt | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 ext/ffi/tests/042.phpt diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 1a8f866520e..e223a52a923 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -1138,10 +1138,16 @@ static void zend_ffi_cdata_write_dim(zval *object, zval *offset, zval *value) /* { zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object); zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type); - zend_long dim = zval_get_long(offset); + zend_long dim; void *ptr; zend_ffi_flags is_const; + if (offset == NULL) { + zend_throw_error(zend_ffi_exception_ce, "Cannot add next element to object of type FFI\\CData"); + return; + } + + dim = zval_get_long(offset); if (EXPECTED(type->kind == ZEND_FFI_TYPE_ARRAY)) { if (UNEXPECTED((zend_ulong)(dim) >= (zend_ulong)type->array.length) && (UNEXPECTED(dim < 0) || UNEXPECTED(type->array.length != 0))) { diff --git a/ext/ffi/tests/042.phpt b/ext/ffi/tests/042.phpt new file mode 100644 index 00000000000..05450d57277 --- /dev/null +++ b/ext/ffi/tests/042.phpt @@ -0,0 +1,16 @@ +--TEST-- +FFI 042: Next array element +--SKIPIF-- + +--INI-- +ffi.enable=1 +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught FFI\Exception: Cannot add next element to object of type FFI\CData in %sext/ffi/tests/042.php:3 +Stack trace: +#0 {main} + thrown in %sext/ffi/tests/042.php on line 3 \ No newline at end of file From c4294440ffc4a59a1298292b76072e6759034a68 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 10 Feb 2019 12:25:19 -0600 Subject: [PATCH 08/16] Fixed bug #77564: Memory leak in exif_process_IFD_TAG The memory leak occurs when more than one UserComment tag is present in the EXIF data. It's still considered corrupt EXIF data, but this ensures the memory is freed before trying to set to already allocated memory. --- NEWS | 3 +++ ext/exif/exif.c | 4 ++++ ext/exif/tests/bug77564/bug77564.jpg | Bin 0 -> 73 bytes ext/exif/tests/bug77564/bug77564.phpt | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 ext/exif/tests/bug77564/bug77564.jpg create mode 100644 ext/exif/tests/bug77564/bug77564.phpt diff --git a/NEWS b/NEWS index fa5200ce845..533b04e5ee7 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ PHP NEWS . Fixed bug #77589 (Core dump using parse_ini_string with numeric sections). (Laruence) +- Exif: + . Fixed bug #77564 (Memory leak in exif_process_IFD_TAG). (Ben Ramsey) + - PDO_OCI: . Support Oracle Database tracing attributes ACTION, MODULE, CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter) diff --git a/ext/exif/exif.c b/ext/exif/exif.c index be02c9da408..9c202196c66 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3405,6 +3405,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha break; case TAG_USERCOMMENT: + EFREE_IF(ImageInfo->UserComment); + ImageInfo->UserComment = NULL; + EFREE_IF(ImageInfo->UserCommentEncoding); + ImageInfo->UserCommentEncoding = NULL; ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count); break; diff --git a/ext/exif/tests/bug77564/bug77564.jpg b/ext/exif/tests/bug77564/bug77564.jpg new file mode 100644 index 0000000000000000000000000000000000000000..868fffd1db11e4f2b3ee294724f0a20b3bc1d88c GIT binary patch literal 73 zcmex=;~|5aYei-n1B0(GgBAk=0}l{0FfdJOV_<~x)R5Rlp?;pu{w}TzjzECS1^_13 B4ix|Z literal 0 HcmV?d00001 diff --git a/ext/exif/tests/bug77564/bug77564.phpt b/ext/exif/tests/bug77564/bug77564.phpt new file mode 100644 index 00000000000..2f72b3c9ac4 --- /dev/null +++ b/ext/exif/tests/bug77564/bug77564.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug 77564 (Memory leak in exif_process_IFD_TAG) +--SKIPIF-- + +--FILE-- + +DONE +--EXPECTF-- + +Warning: exif_read_data(bug77564.jpg): Illegal IFD offset in %sbug77564.php on line %d + +Warning: exif_read_data(bug77564.jpg): File structure corrupted in %sbug77564.php on line %d + +Warning: exif_read_data(bug77564.jpg): Invalid JPEG file in %sbug77564.php on line %d +bool(false) +DONE From d8b2705d6262f208b593b7c43cd66670dffc5a12 Mon Sep 17 00:00:00 2001 From: Jachim Coudenys Date: Mon, 27 Nov 2017 21:14:10 +0100 Subject: [PATCH 09/16] Test mb_str* functions for 'unknown encoding' warnings --- .../tests/mb_str_unknown_encoding.phpt | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 ext/mbstring/tests/mb_str_unknown_encoding.phpt diff --git a/ext/mbstring/tests/mb_str_unknown_encoding.phpt b/ext/mbstring/tests/mb_str_unknown_encoding.phpt new file mode 100644 index 00000000000..393b0b55b18 --- /dev/null +++ b/ext/mbstring/tests/mb_str_unknown_encoding.phpt @@ -0,0 +1,77 @@ +--TEST-- +mb_str*() - unknown encoding +--CREDITS-- +Jachim Coudenys +User Group: PHP-WVL & PHPGent #PHPTestFest +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mb_chr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_convert_case(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d + +Warning: mb_convert_kana(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_decode_numericentity(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_ord(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strcut(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strimwidth(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_stripos(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_stristr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strlen(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strpos(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strrchr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strrichr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strripos(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strrpos(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strstr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strtolower(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strtoupper(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_strwidth(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_substr(): Unknown encoding "UTF-0" in %s on line %d + +Warning: mb_substr_count(): Unknown encoding "UTF-0" in %s on line %d + From a109fddba4e3fbb6e3a2e008c0fa20a57f26103d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 12 Feb 2019 09:54:52 +0100 Subject: [PATCH 10/16] Remove "defensive copy" of DatePeriod properties get_properties() constructs these as fresh objects with no relation to the internals, there is no need to clone them again. Additionally the current implementation leaks memory, because the original objects are never freed (see PR #3121). --- ext/date/php_date.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 1e136e00b6c..c8479b5164e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -5278,7 +5278,6 @@ PHP_METHOD(DatePeriod, __wakeup) /* {{{ date_period_read_property */ static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { - zval *zv; if (type != BP_VAR_IS && type != BP_VAR_R) { zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported"); return &EG(uninitialized_zval); @@ -5286,13 +5285,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi Z_OBJPROP_P(object); /* build properties hash table */ - zv = std_object_handlers.read_property(object, member, type, cache_slot, rv); - if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJ_HANDLER_P(zv, clone_obj)) { - /* defensive copy */ - ZVAL_OBJ(zv, Z_OBJ_HANDLER_P(zv, clone_obj)(zv)); - } - - return zv; + return std_object_handlers.read_property(object, member, type, cache_slot, rv); } /* }}} */ From b5cb3ac8ecab71bfe1eb7d5b2d7a48970e11a5b4 Mon Sep 17 00:00:00 2001 From: hsldymq Date: Thu, 28 Jun 2018 02:25:11 +0800 Subject: [PATCH 11/16] Make pid & uid available while handling realtime signals --- ext/pcntl/pcntl.c | 6 ++++++ ext/pcntl/tests/pcntl_realtime_signal.phpt | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 ext/pcntl/tests/pcntl_realtime_signal.phpt diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 228111d351c..36d2a672ab9 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1276,6 +1276,12 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi break; #endif } +#if defined(SIGRTMIN) && defined(SIGRTMAX) + if (SIGRTMIN <= signo && signo <= SIGRTMAX) { + add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo->si_pid); + add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo->si_uid); + } +#endif } } /* }}} */ diff --git a/ext/pcntl/tests/pcntl_realtime_signal.phpt b/ext/pcntl/tests/pcntl_realtime_signal.phpt new file mode 100644 index 00000000000..212f15e03bb --- /dev/null +++ b/ext/pcntl/tests/pcntl_realtime_signal.phpt @@ -0,0 +1,20 @@ +--TEST-- +pcntl_signal() context of realtime signal +--SKIPIF-- + + + +--FILE-- + +--EXPECTF-- +%rgot realtime signal from \d+, ruid:\d+%r +ok From 4e87e56e22958ae43078c216178e2c080c722f14 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 7 Feb 2019 14:23:27 +0000 Subject: [PATCH 12/16] Adding bunch of FreeBSD socket options flags specifics. SO_USER_COOKIE primarly to be traced via dtrace instrumentation. If SO_USER_COOKIE is available, the rest is so the former is two years old while the rest is from around 2008. --- UPGRADING | 8 ++++++++ ext/sockets/sockets.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/UPGRADING b/UPGRADING index e33e75991c3..9ba0dfdbe3f 100644 --- a/UPGRADING +++ b/UPGRADING @@ -256,6 +256,14 @@ PHP 7.4 UPGRADE NOTES . MB_ONIGURUMA_VERSION specifies the version of the oniguruma library against which mbregex has been built. +- Socket: + . Added FreeBSD-specific socket options: + . SO_LABEL + . SO_PEERLABEL + . SO_LISTENQLIMIT + . SO_LISTENQLEN + . SO_USER_COOKIE + - Tidy: . TIDY_TAG_ARTICLE . TIDY_TAG_ASIDE diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index ea8caa72988..46484e35662 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -781,6 +781,13 @@ static PHP_MINIT_FUNCTION(sockets) REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); #ifdef SO_BINDTODEVICE REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); +#endif +#ifdef SO_USER_COOKIE + REGISTER_LONG_CONSTANT("SO_LABEL", SO_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_PEERLABEL", SO_PEERLABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_LISTENQLIMIT", SO_LISTENQLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_LISTENQLEN", SO_LISTENQLEN, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SO_USER_COOKIE", SO_USER_COOKIE, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); From 8e34de475699a4aa0fbc7b8430574b56dc839362 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 12 Feb 2019 10:49:20 +0100 Subject: [PATCH 13/16] Fixed bug #77608 Remove special handling of doubles and escape them as usual instead. --- NEWS | 2 ++ ext/standard/http.c | 9 --------- ext/standard/tests/strings/bug77608.phpt | 11 +++++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 ext/standard/tests/strings/bug77608.phpt diff --git a/NEWS b/NEWS index 533b04e5ee7..6fa239021d8 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ PHP NEWS - Standard: . Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions). (John Stevenson) + . Fixed bug #77608 (http_build_query doesn't encode "+" in a float number). + (Nikita) 07 Feb 2019, PHP 7.2.15 diff --git a/ext/standard/http.c b/ext/standard/http.c index f73d4cac7eb..c11c940abed 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -192,15 +192,6 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, case IS_TRUE: smart_str_appendl(formstr, "1", sizeof("1")-1); break; - case IS_DOUBLE: - { - char *ekey; - size_t ekey_len; - ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_P(zdata)); - smart_str_appendl(formstr, ekey, ekey_len); - efree(ekey); - } - break; default: { zend_string *ekey; diff --git a/ext/standard/tests/strings/bug77608.phpt b/ext/standard/tests/strings/bug77608.phpt new file mode 100644 index 00000000000..77bfb74a872 --- /dev/null +++ b/ext/standard/tests/strings/bug77608.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #77608: http_build_query doesn't encode "+" in a float number +--FILE-- + 1E+14, "y" => "1E+14"]; +echo http_build_query($a); + +?> +--EXPECT-- +x=1.0E%2B14&y=1E%2B14 From dbd7fbabe9f0d97b87afec3657ce53b4e5e25b3f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 12 Feb 2019 13:24:14 +0300 Subject: [PATCH 14/16] typo --- ext/ffi/ffi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index e223a52a923..2da7fd44736 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -5302,7 +5302,7 @@ void zend_ffi_add_bit_field(zend_ffi_dcl *struct_dcl, const char *name, size_t n zend_ffi_parser_error("wrong type of bit field '%.*s' at line %d", name ? name_len : sizeof("")-1, name ? name : "", FFI_G(line)); } - if (bits->kind == ZEND_FFI_VAL_INT32 || ZEND_FFI_VAL_INT64) { + if (bits->kind == ZEND_FFI_VAL_INT32 || bits->kind == ZEND_FFI_VAL_INT64) { if (bits->i64 < 0) { zend_ffi_cleanup_dcl(field_dcl); zend_ffi_parser_error("negative width in bit-field '%.*s' at line %d", name ? name_len : sizeof("")-1, name ? name : "", FFI_G(line)); @@ -5316,7 +5316,7 @@ void zend_ffi_add_bit_field(zend_ffi_dcl *struct_dcl, const char *name, size_t n zend_ffi_cleanup_dcl(field_dcl); zend_ffi_parser_error("width of '%.*s' exceeds its type at line %d", name ? name_len : sizeof("")-1, name ? name : "", FFI_G(line)); } - } else if (ZEND_FFI_VAL_UINT32 || ZEND_FFI_VAL_UINT64) { + } else if (bits->kind == ZEND_FFI_VAL_UINT32 || bits->kind == ZEND_FFI_VAL_UINT64) { if (bits->u64 == 0) { zend_ffi_cleanup_dcl(field_dcl); if (name) { From 07877c46e3057bc679766898d50529be812243f3 Mon Sep 17 00:00:00 2001 From: DanielCiochiu Date: Tue, 12 Feb 2019 11:40:46 +0100 Subject: [PATCH 15/16] Fixed bug #75546 By respecting the SILENT flag when checking the visibility of a class constant. --- NEWS | 2 ++ Zend/zend_constants.c | 4 +++- ext/standard/tests/general_functions/bug72920.phpt | 11 ++++------- tests/classes/constants_visibility_002.phpt | 6 +----- tests/classes/constants_visibility_003.phpt | 6 +----- tests/classes/constants_visibility_008.phpt | 12 ++++++++++++ 6 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 tests/classes/constants_visibility_008.phpt diff --git a/NEWS b/NEWS index 6fa239021d8..2972812f1f3 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Core: . Fixed bug #77589 (Core dump using parse_ini_string with numeric sections). (Laruence) + . Fixed bug #75546 (function "defined" should ignore class constant + visibility). (Daniel Ciochiu) - Exif: . Fixed bug #77564 (Memory leak in exif_process_IFD_TAG). (Ben Ramsey) diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 14d712235a0..64265d3c19c 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -341,7 +341,9 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, ret_constant = NULL; } else { if (!zend_verify_const_access(c, scope)) { - zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { + zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); + } goto failure; } ret_constant = &c->value; diff --git a/ext/standard/tests/general_functions/bug72920.phpt b/ext/standard/tests/general_functions/bug72920.phpt index b5ca4760c30..8ba4d267136 100644 --- a/ext/standard/tests/general_functions/bug72920.phpt +++ b/ext/standard/tests/general_functions/bug72920.phpt @@ -6,10 +6,7 @@ class Foo { private const C1 = "a"; } -try { - var_dump(constant('Foo::C1')); -} catch (Error $e) { - var_dump($e->getMessage()); -} ---EXPECT-- -string(35) "Cannot access private const Foo::C1" +var_dump(constant('Foo::C1')); +--EXPECTF-- +Warning: constant(): Couldn't find constant Foo::C1 in %s on line %d +NULL diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt index 6ec99012694..4e0ecb1aa23 100644 --- a/tests/classes/constants_visibility_002.phpt +++ b/tests/classes/constants_visibility_002.phpt @@ -21,8 +21,4 @@ constant('A::protectedConst'); string(14) "protectedConst" string(14) "protectedConst" -Fatal error: Uncaught Error: Cannot access protected const A::protectedConst in %s:14 -Stack trace: -#0 %s(14): constant('A::protectedCon...') -#1 {main} - thrown in %s on line 14 +Warning: constant(): Couldn't find constant A::protectedConst in %s on line %d diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt index 9c7bcfb21c3..7c961695ed6 100644 --- a/tests/classes/constants_visibility_003.phpt +++ b/tests/classes/constants_visibility_003.phpt @@ -21,8 +21,4 @@ constant('A::privateConst'); string(12) "privateConst" string(12) "privateConst" -Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14 -Stack trace: -#0 %s(14): constant('A::privateConst') -#1 {main} - thrown in %s on line 14 +Warning: constant(): Couldn't find constant A::privateConst in %s on line %d diff --git a/tests/classes/constants_visibility_008.phpt b/tests/classes/constants_visibility_008.phpt new file mode 100644 index 00000000000..f24b70cf59b --- /dev/null +++ b/tests/classes/constants_visibility_008.phpt @@ -0,0 +1,12 @@ +--TEST-- +Defined on private constant should not raise exception +--FILE-- + Date: Tue, 12 Feb 2019 13:57:44 +0100 Subject: [PATCH 16/16] Fix FFI test on Windows --- ext/ffi/tests/042.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/ffi/tests/042.phpt b/ext/ffi/tests/042.phpt index 05450d57277..2fcec62698c 100644 --- a/ext/ffi/tests/042.phpt +++ b/ext/ffi/tests/042.phpt @@ -10,7 +10,7 @@ $a = FFI::new("uint8_t[8]"); $a[] = 0; ?> --EXPECTF-- -Fatal error: Uncaught FFI\Exception: Cannot add next element to object of type FFI\CData in %sext/ffi/tests/042.php:3 +Fatal error: Uncaught FFI\Exception: Cannot add next element to object of type FFI\CData in %s:3 Stack trace: #0 {main} - thrown in %sext/ffi/tests/042.php on line 3 \ No newline at end of file + thrown in %s on line 3