Skip to content

Only display report_memleaks deprecation message in debug builds #19521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

alexandre-daubois
Copy link
Member

The deprecation message about report_memleaks is being displayed when PHPT files are executed with PHPUnit. The PhptTestCase runner sets report_memleaks=0. A recent commit (sebastianbergmann/phpunit@0eae114) removes the setting. However, it’s been pushed to PHPUnit master and it doesn’t seem to be backported to old versions.

You can see that the Symfony CI is a flooded by the deprecation message: https://github.com/symfony/symfony/actions/runs/17072154862/job/48412448854.

@nicolas-grekas proposes to disable the deprecation message on release build, the setting being no-op anyway, see #19481 (comment).

@alexandre-daubois alexandre-daubois changed the title Only display report_memleaks deprecation message with debug builds Only display report_memleaks deprecation message in debug builds Aug 19, 2025
@alexandre-daubois alexandre-daubois marked this pull request as ready for review August 19, 2025 16:25
Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. For better or worse the INI setting also exists for non-debug builds (e.g. it can be interacted with using ini_get() and ini_set()) and thus it should behave consistently across both modes. Part of the motivation for me is that folks might've used the INI setting without being aware that it does nothing for production builds. Making them aware that they can safely remove it is a feature. Otherwise it might get included in scripts and tutorials for eternity.

@TimWolla TimWolla requested review from a team and Girgias August 19, 2025 17:36
@nicolas-grekas
Copy link
Contributor

That's very unlikely, the current comment on the setting is very clear about it.
Also, unused ini settings are juste ignored silently.
The annoyance is going to be strong, especially since the default php.ini does have an uncommented line for this one on ondrej's sury binaries, which many use on Ubuntu-like.

@TimWolla
Copy link
Member

TimWolla commented Aug 19, 2025

The annoyance is going to be strong, especially since the default php.ini does have an uncommented line for this one on ondrej's sury binaries, which many use on Ubuntu-like.

It is true that the default php.ini of Sury's PPA has an uncommented report_memleaks = On by default. And that will not warn, since it matches the built-in default / the future only option of enabling the reporting of memory leaks.

The deprecation message will only be emitted if you change the report_memleaks option from its default to Off / 0.

@nicolas-grekas
Copy link
Contributor

Ah right, that alleviate my concern, thanks for reminding me that. Every deprecation has a cost, so I'm careful about minimizing that cost / reduce needless friction for adoption of newer versions.

Copy link
Member

@DanielEScherzer DanielEScherzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a release manager, this is ~approved in that there are no release considerations as long as it gets approved via the normal process too

As a core developer, however, I agree that we should always have the warning

@TimWolla
Copy link
Member

@alexandre-daubois Given that Nicolas' concerns seem to be resolved and the reviews from Daniel and me, should we close this?

@alexandre-daubois
Copy link
Member Author

Because the fix in PHPUnit is present in all maintained branches, I would say yes. Thanks for participating!

@alexandre-daubois alexandre-daubois deleted the rep-memleaks-debug branch August 20, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants