diff --git a/NEWS b/NEWS index 0180f5b3478a6..979ee86090533 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ 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) - ODBC: . Remove ODBCVER and assume ODBC 3.5. (Calvin Buckley) diff --git a/UPGRADING b/UPGRADING index e586933fd9338..35fa5ef09c70b 100644 --- a/UPGRADING +++ b/UPGRADING @@ -337,6 +337,8 @@ 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 - Curl: . The curl_close() function has been deprecated, as CurlHandle objects are 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 b6b2ee40a8bc2..38cc5c6c56508 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 c363bcb6e5fa3..b301182f29eaa 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.