wiki.techinc.nl/tests/phpunit/includes/debug
Timo Tijhof 83d4898319 debug: Migrate E_USER_ERROR to throw Error in DeprecationHelper
For a long time now, since PHP 7.0.0, access to non-public properties
has thrown Error, not emitted E_ERROR.

Example - https://3v4l.org/dHChU

Our simulation of this in DeprecationHelper is meant to do what PHP
does, so, given we no longer support PHP 5.6 and can thus construct
Error ourselves, we should do the same.

This is identical - https://3v4l.org/koUqu

== Why ==

Referencing the E_USER_ERROR constant causes a deprecation warning
in PHP 8.4+.

== Change ==

The source change is straight-forward.

One of the tests (testSet, dataset 4 "fallbackGetterOnly") was
previously passing by accident. The source called trigger_error twice,
first with E_USER_DEPRECATED (via wfDeprecated) and then again with
E_USER_ERROR. Given that these are asserted via set_error_handler,
an event calback, the callback is run after the callback finished
(it does not interrupt), at which point only the last values are
reported to the event handler. Improve on this by explicitly hiding
the deprecation warning, and focus the case on testing the error.

Bug: T379445
Change-Id: Ia0aff9906102023370f3907e01962a5e1e369125
(cherry picked from commit d0920b8fb5be462a7aba5c21e47b02c2c2f5025f)
2025-06-13 07:40:14 +00:00
..
logger
DeprecationHelperTest.php debug: Migrate E_USER_ERROR to throw Error in DeprecationHelper 2025-06-13 07:40:14 +00:00
MWDebugTest.php tests: Use namespaced classes 2024-10-21 18:53:02 +02:00
TestDeprecatedClass.php
TestDeprecatedSubclass.php