diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b0942b4d700ed..47001d85bb3a2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -112,6 +112,7 @@ jobs: with: configurationParameters: >- --${{ matrix.debug && 'enable' || 'disable' }}-debug + ${{ matrix.debug && 'CXXFLAGS="-D_GLIBCXX_ASSERTIONS"' || '' }} --${{ matrix.zts && 'enable' || 'disable' }}-zts ${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang CXX=clang++' || '' }} skipSlow: ${{ matrix.asan }} diff --git a/NEWS b/NEWS index 09d9b87aafa22..62c98e0b43766 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ PHP NEWS triggers "Constant already defined" warning). (ilutov) . Fixed bug GH-19476 (pipe operator fails to correctly handle returning by reference). (alexandre-daubois) + . The report_memleaks INI directive has been deprecated. (alexandre-daubois) + . Constant redeclaration is deprecated and this behavior will trigger an + error in PHP 9. (alexandre-daubois) - ODBC: . Remove ODBCVER and assume ODBC 3.5. (Calvin Buckley) @@ -18,6 +21,9 @@ PHP NEWS - Session: . Added support for partitioned cookies. (nielsdos) +- SPL: + . Deprecate ArrayObject and ArrayIterator with objects. (Girgias) + - Standard: . Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois) . Passing integers outside the interval [0, 255] to chr() is now deprecated. diff --git a/UPGRADING b/UPGRADING index dfaf8f0817c53..cf146f6fa16d6 100644 --- a/UPGRADING +++ b/UPGRADING @@ -344,6 +344,11 @@ PHP 8.5 UPGRADE NOTES . Returning null from __debugInfo() has been deprecated. Return an empty array instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null + . The report_memleaks INI directive has been deprecated. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_report_memleaks_ini_directive + . Constant redeclaration is deprecated and that behavior will trigger an + error in PHP 9. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_constant_redeclaration - Curl: . The curl_close() function has been deprecated, as CurlHandle objects are @@ -421,6 +426,8 @@ PHP 8.5 UPGRADE NOTES SplObjectStorage::offsetExists(), SplObjectStorage::offsetSet(), and SplObjectStorage::offsetUnset() respectively. RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach + . Using ArrayObject and ArrayIterator with objects has been deprecated. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects - Standard: . The socket_set_timeout() alias function has been deprecated. diff --git a/Zend/tests/attributes/constants/constant_redefined_addition.phpt b/Zend/tests/attributes/constants/constant_redefined_addition.phpt index 08f9670989627..5831332afdc5b 100644 --- a/Zend/tests/attributes/constants/constant_redefined_addition.phpt +++ b/Zend/tests/attributes/constants/constant_redefined_addition.phpt @@ -15,7 +15,7 @@ var_dump($reflection->getAttributes()) ?> --EXPECTF-- -Warning: Constant MY_CONST already defined in %s on line %d +Warning: Constant MY_CONST already defined, this will be an error in PHP 9 in %s on line %d No attributes array(0) { } diff --git a/Zend/tests/attributes/constants/constant_redefined_change.phpt b/Zend/tests/attributes/constants/constant_redefined_change.phpt index 158753ee07d84..1682f9c2a2996 100644 --- a/Zend/tests/attributes/constants/constant_redefined_change.phpt +++ b/Zend/tests/attributes/constants/constant_redefined_change.phpt @@ -16,7 +16,7 @@ var_dump($reflection->getAttributes()) ?> --EXPECTF-- -Warning: Constant MY_CONST already defined in %s on line %d +Warning: Constant MY_CONST already defined, this will be an error in PHP 9 in %s on line %d Has attributes (1) array(1) { [0]=> diff --git a/Zend/tests/attributes/constants/constant_redefined_removal.phpt b/Zend/tests/attributes/constants/constant_redefined_removal.phpt index 0b679a55985e3..45476ab6f000c 100644 --- a/Zend/tests/attributes/constants/constant_redefined_removal.phpt +++ b/Zend/tests/attributes/constants/constant_redefined_removal.phpt @@ -15,7 +15,7 @@ var_dump($reflection->getAttributes()) ?> --EXPECTF-- -Warning: Constant MY_CONST already defined in %s on line %d +Warning: Constant MY_CONST already defined, this will be an error in PHP 9 in %s on line %d Has attributes array(1) { [0]=> diff --git a/Zend/tests/bug29890.phpt b/Zend/tests/bug29890.phpt index 6f1e874882e62..27cb1b311ea94 100644 --- a/Zend/tests/bug29890.phpt +++ b/Zend/tests/bug29890.phpt @@ -20,4 +20,4 @@ define("TEST",3); ?> --EXPECT-- -error :Constant TEST already defined +error :Constant TEST already defined, this will be an error in PHP 9 diff --git a/Zend/tests/constants/008.phpt b/Zend/tests/constants/008.phpt index f690cee8e9835..14e074e5d30ac 100644 --- a/Zend/tests/constants/008.phpt +++ b/Zend/tests/constants/008.phpt @@ -27,13 +27,13 @@ echo "Done\n"; --EXPECTF-- TypeError: define(): Argument #1 ($constant_name) must be of type string, array given -Warning: Constant TRUE already defined in %s on line %d +Warning: Constant TRUE already defined, this will be an error in PHP 9 in %s on line %d bool(false) bool(true) bool(true) bool(true) -Warning: Constant test const already defined in %s on line %d +Warning: Constant test const already defined, this will be an error in PHP 9 in %s on line %d bool(false) bool(true) bool(true) diff --git a/Zend/tests/constants/constants_001.phpt b/Zend/tests/constants/constants_001.phpt index 7b274d6fd9c3a..95e22736c10e2 100644 --- a/Zend/tests/constants/constants_001.phpt +++ b/Zend/tests/constants/constants_001.phpt @@ -17,7 +17,7 @@ var_dump(constant('1foo')); ?> --EXPECTF-- -Warning: Constant 1 already defined in %s on line %d +Warning: Constant 1 already defined, this will be an error in PHP 9 in %s on line %d int(2) int(2) int(2) diff --git a/Zend/tests/constants/constants_004.phpt b/Zend/tests/constants/constants_004.phpt index e981415361253..b1482a50ece17 100644 --- a/Zend/tests/constants/constants_004.phpt +++ b/Zend/tests/constants/constants_004.phpt @@ -10,4 +10,4 @@ const foo = 2; ?> --EXPECTF-- -Warning: Constant foo\foo already defined in %s on line %d +Warning: Constant foo\foo already defined, this will be an error in PHP 9 in %s on line %d diff --git a/Zend/tests/constants/constants_008.phpt b/Zend/tests/constants/constants_008.phpt index 17c6904579caf..857589ce23ddd 100644 --- a/Zend/tests/constants/constants_008.phpt +++ b/Zend/tests/constants/constants_008.phpt @@ -13,5 +13,5 @@ if (defined('a')) { ?> --EXPECTF-- -Warning: Constant a already defined in %s on line %d +Warning: Constant a already defined, this will be an error in PHP 9 in %s on line %d 2 diff --git a/Zend/tests/constants/halt_compiler/bug53305.phpt b/Zend/tests/constants/halt_compiler/bug53305.phpt index c76b582e244a9..abf40d9fd6204 100644 --- a/Zend/tests/constants/halt_compiler/bug53305.phpt +++ b/Zend/tests/constants/halt_compiler/bug53305.phpt @@ -14,6 +14,6 @@ var_dump(constant('__COMPILER_HALT_OFFSET__1'.chr(0))); ?> --EXPECTF-- -Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d +Warning: Constant __COMPILER_HALT_OFFSET__ already defined, this will be an error in PHP 9 in %s on line %d int(1) int(4) diff --git a/Zend/tests/constants/halt_compiler/halt_compiler3.phpt b/Zend/tests/constants/halt_compiler/halt_compiler3.phpt index ff25b13333639..412c8cf2220ef 100644 --- a/Zend/tests/constants/halt_compiler/halt_compiler3.phpt +++ b/Zend/tests/constants/halt_compiler/halt_compiler3.phpt @@ -5,4 +5,4 @@ __HALT_COMPILER(); bad define() of __COMPILER_HALT_OFFSET__ 1 define ('__COMPILER_HALT_OFFSET__', 1); ?> --EXPECTF-- -Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d +Warning: Constant __COMPILER_HALT_OFFSET__ already defined, this will be an error in PHP 9 in %s on line %d diff --git a/Zend/tests/constants/halt_compiler/halt_compiler4.phpt b/Zend/tests/constants/halt_compiler/halt_compiler4.phpt index bb96f25ed96b7..2a1997eca22d8 100644 --- a/Zend/tests/constants/halt_compiler/halt_compiler4.phpt +++ b/Zend/tests/constants/halt_compiler/halt_compiler4.phpt @@ -7,4 +7,4 @@ __HALT_COMPILER(); ?> ==DONE== --EXPECTF-- -Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d +Warning: Constant __COMPILER_HALT_OFFSET__ already defined, this will be an error in PHP 9 in %s on line %d diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index cdab1bfced40b..efdcb905fd773 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -541,7 +541,7 @@ ZEND_API zend_constant *zend_register_constant(zend_constant *c) || (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name))) || (ret = zend_hash_add_constant(EG(zend_constants), name, c)) == NULL ) { - zend_error(E_WARNING, "Constant %s already defined", ZSTR_VAL(name)); + zend_error(E_WARNING, "Constant %s already defined, this will be an error in PHP 9", ZSTR_VAL(name)); zend_string_release(c->name); if (c->filename) { zend_string_release(c->filename); diff --git a/build/gen_stub.php b/build/gen_stub.php index 4164e2aa48628..5c8407c0564c5 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -6056,7 +6056,7 @@ function initPhpParser() { } $isInitialized = true; - $version = "5.6.0"; + $version = "5.6.1"; $phpParserDir = __DIR__ . "/PHP-Parser-$version"; if (!is_dir($phpParserDir)) { installPhpParser($version, $phpParserDir); diff --git a/ext/opcache/tests/bug71127.phpt b/ext/opcache/tests/bug71127.phpt index a417f0d3120ae..68f6d36895d04 100644 --- a/ext/opcache/tests/bug71127.phpt +++ b/ext/opcache/tests/bug71127.phpt @@ -21,5 +21,5 @@ include($file); @unlink(__DIR__ . "/bug71127.inc"); ?> --EXPECTF-- -Warning: Constant FOO already defined in %sbug71127.inc on line %d +Warning: Constant FOO already defined, this will be an error in PHP 9 in %sbug71127.inc on line %d okey diff --git a/main/main.c b/main/main.c index 8465b6c09b1e0..24fb55543790e 100644 --- a/main/main.c +++ b/main/main.c @@ -698,6 +698,19 @@ static PHP_INI_MH(OnUpdateInputEncoding) } /* }}} */ +static PHP_INI_MH(OnUpdateReportMemleaks) +{ + bool *p = (bool *) ZEND_INI_GET_ADDR(); + bool new_bool_value = zend_ini_parse_bool(new_value); + + if (!new_bool_value) { + php_error_docref(NULL, E_DEPRECATED, "Directive 'report_memleaks' is deprecated"); + } + + *p = new_bool_value; + return SUCCESS; +} + /* {{{ PHP_INI_MH */ static PHP_INI_MH(OnUpdateOutputEncoding) { @@ -801,7 +814,7 @@ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_errors", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals) - STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateBool, report_memleaks, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateReportMemleaks, report_memleaks, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("report_zend_debug", "0", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals) STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals) STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals) diff --git a/php.ini-development b/php.ini-development index 12db95597c1ff..852561435b1d0 100644 --- a/php.ini-development +++ b/php.ini-development @@ -537,11 +537,12 @@ ignore_repeated_errors = Off ; https://php.net/ignore-repeated-source ignore_repeated_source = Off +; Use of this INI entry is deprecated, it will be removed in PHP 9.0. ; If this parameter is set to Off, then memory leaks will not be shown (on ; stdout or in the log). This is only effective in a debug compile, and if ; error reporting includes E_WARNING in the allowed list ; https://php.net/report-memleaks -report_memleaks = On +;report_memleaks = On ; This setting is off by default. ;report_zend_debug = 0 diff --git a/php.ini-production b/php.ini-production index d144f952e7279..fea8830e56fca 100644 --- a/php.ini-production +++ b/php.ini-production @@ -539,11 +539,12 @@ ignore_repeated_errors = Off ; https://php.net/ignore-repeated-source ignore_repeated_source = Off +; Use of this INI entry is deprecated, it will be removed in PHP 9.0. ; If this parameter is set to Off, then memory leaks will not be shown (on ; stdout or in the log). This is only effective in a debug compile, and if ; error reporting includes E_WARNING in the allowed list ; https://php.net/report-memleaks -report_memleaks = On +;report_memleaks = On ; This setting is off by default. ;report_zend_debug = 0 diff --git a/run-tests.php b/run-tests.php index 6c31c1d0187d9..171f6e2e5b6d7 100755 --- a/run-tests.php +++ b/run-tests.php @@ -278,7 +278,6 @@ function main(): void 'log_errors=0', 'html_errors=0', 'track_errors=0', - 'report_memleaks=1', 'report_zend_debug=0', 'docref_root=', 'docref_ext=.html', diff --git a/tests/basic/ini_directive_deprecated_report_memleaks.phpt b/tests/basic/ini_directive_deprecated_report_memleaks.phpt new file mode 100644 index 0000000000000..961726b499e72 --- /dev/null +++ b/tests/basic/ini_directive_deprecated_report_memleaks.phpt @@ -0,0 +1,11 @@ +--TEST-- +Deprecated INI directive report_memleaks warning +--INI-- +report_memleaks=0 +--FILE-- + +--EXPECT-- +Deprecated: PHP Startup: Directive 'report_memleaks' is deprecated in Unknown on line 0 +Testing deprecated report_memleaks INI directive.