Skip to content

Commit e3f4fef

Browse files
Deprecate disabling report_memleaks INI directive
1 parent fb87b14 commit e3f4fef

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PHP NEWS
2929
(timwolla)
3030
. Returning null from __debugInfo() has been deprecated. (DanielEScherzer)
3131
. Support #[\Override] on properties. (Jiří Pudil)
32+
. The report_memleaks INI directive has been deprecated. (alexandre-daubois)
3233

3334
- Curl:
3435
. The curl_close() function has been deprecated. (DanielEScherzer)

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ PHP 8.5 UPGRADE NOTES
337337
. Returning null from __debugInfo() has been deprecated.
338338
Return an empty array instead.
339339
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null
340+
. The report_memleaks INI directive has been deprecated.
340341

341342
- Curl:
342343
. The curl_close() function has been deprecated, as CurlHandle objects are

main/main.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,19 @@ static PHP_INI_MH(OnUpdateInputEncoding)
698698
}
699699
/* }}} */
700700

701+
static PHP_INI_MH(OnUpdateReportMemleaks)
702+
{
703+
bool *p = (bool *) ZEND_INI_GET_ADDR();
704+
bool new_bool_value = zend_ini_parse_bool(new_value);
705+
706+
if (!new_bool_value) {
707+
php_error_docref(NULL, E_DEPRECATED, "Directive 'report_memleaks' is deprecated");
708+
}
709+
710+
*p = new_bool_value;
711+
return SUCCESS;
712+
}
713+
701714
/* {{{ PHP_INI_MH */
702715
static PHP_INI_MH(OnUpdateOutputEncoding)
703716
{
@@ -801,7 +814,7 @@ PHP_INI_BEGIN()
801814
STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals)
802815
STD_PHP_INI_BOOLEAN("ignore_repeated_errors", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_errors, php_core_globals, core_globals)
803816
STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals)
804-
STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateBool, report_memleaks, php_core_globals, core_globals)
817+
STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateReportMemleaks, report_memleaks, php_core_globals, core_globals)
805818
STD_PHP_INI_BOOLEAN("report_zend_debug", "0", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals)
806819
STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals)
807820
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals)

php.ini-development

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,12 @@ ignore_repeated_errors = Off
537537
; https://php.net/ignore-repeated-source
538538
ignore_repeated_source = Off
539539

540+
; Use of this INI entry is deprecated, it will be removed in PHP 9.0.
540541
; If this parameter is set to Off, then memory leaks will not be shown (on
541542
; stdout or in the log). This is only effective in a debug compile, and if
542543
; error reporting includes E_WARNING in the allowed list
543544
; https://php.net/report-memleaks
544-
report_memleaks = On
545+
;report_memleaks = On
545546

546547
; This setting is off by default.
547548
;report_zend_debug = 0

php.ini-production

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,12 @@ ignore_repeated_errors = Off
539539
; https://php.net/ignore-repeated-source
540540
ignore_repeated_source = Off
541541

542+
; Use of this INI entry is deprecated, it will be removed in PHP 9.0.
542543
; If this parameter is set to Off, then memory leaks will not be shown (on
543544
; stdout or in the log). This is only effective in a debug compile, and if
544545
; error reporting includes E_WARNING in the allowed list
545546
; https://php.net/report-memleaks
546-
report_memleaks = On
547+
;report_memleaks = On
547548

548549
; This setting is off by default.
549550
;report_zend_debug = 0

run-tests.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ function main(): void
278278
'log_errors=0',
279279
'html_errors=0',
280280
'track_errors=0',
281-
'report_memleaks=1',
282281
'report_zend_debug=0',
283282
'docref_root=',
284283
'docref_ext=.html',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Deprecated INI directive report_memleaks warning
3+
--INI--
4+
report_memleaks=0
5+
--FILE--
6+
<?php
7+
echo "Testing deprecated report_memleaks INI directive.\n";
8+
?>
9+
--EXPECT--
10+
Deprecated: PHP Startup: Directive 'report_memleaks' is deprecated in Unknown on line 0
11+
Testing deprecated report_memleaks INI directive.

0 commit comments

Comments
 (0)