1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Deprecate disabling report_memleaks INI directive (#19481)

RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_report_memleaks_ini_directive
This commit is contained in:
Alexandre Daubois
2025-08-16 14:04:34 +02:00
committed by GitHub
parent 7ca21d2e07
commit a84a82ed88
7 changed files with 32 additions and 4 deletions

1
NEWS
View File

@@ -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)

View File

@@ -344,6 +344,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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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',

View File

@@ -0,0 +1,11 @@
--TEST--
Deprecated INI directive report_memleaks warning
--INI--
report_memleaks=0
--FILE--
<?php
echo "Testing deprecated report_memleaks INI directive.\n";
?>
--EXPECT--
Deprecated: PHP Startup: Directive 'report_memleaks' is deprecated in Unknown on line 0
Testing deprecated report_memleaks INI directive.