PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing).
The recommended replacements are either to use exceptions or to do a hard `exit`.
This is an unmaintained external dependency; thus, the fix is made in the WP specific copy of the dependency.
As `trigger_error()` call looks to be a remnant of the PHP 4 era before a class could be declared as `abstract`, fixed by making both the method as well as the class `abstract` and removing the call to `trigger_error()`.
Ref:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
* https://www.php.net/manual/en/migration80.incompatible.php
Follow-up to [7747].
Props jrf.
See #62061.
Built from https://develop.svn.wordpress.org/trunk@59106
git-svn-id: http://core.svn.wordpress.org/trunk@58502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
PHP 8.4 deprecates the use of `trigger_errror()` with `E_USER_ERROR` as the error level, as there are a number of gotchas to this way of creating a `Fatal Error` (`finally` blocks not executing, destructors not executing). The recommended replacements are either to use exceptions or to do a hard `exit`.
This is an unmaintained external dependency; thus, the fix is made in the WP specific copy of the dependency.
Now, there were basically three options:
* Silence the deprecation until PHP 9.0 and delay properly solving this until then.
This would lead to an awkward solution, as prior to PHP 8.0, error silencing would apply to all errors, while, as of PHP 8.0, it will no longer apply to fatal errors.
It also would only buy us some time and wouldn't actually solve anything.
* Use `exit($status)`.
This would make the code untestable and would disable handling of these errors via custom error handlers, which makes this an undesirable solution.
* Throw an exception.
This makes for the most elegant solution with the least BC-breaking impact.
The third option is implemented which:
* Introduces a new `Text_Exception` class.
* Starts using that in the `Text_Diff::_check()` method in all applicable places.
* Adds tests for the first two error conditions.
References:
* https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
* https://www.php.net/manual/en/migration80.incompatible.php
Follow-up to [59070], [52978], [7747].
Props jrf.
See #62061.
Built from https://develop.svn.wordpress.org/trunk@59105
git-svn-id: http://core.svn.wordpress.org/trunk@58501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On the first `foreach` loop in Text_Diff::_check()`, `$prevtype` is `null`. As `instanceof` requires the class name term to be an object or string, a fatal error is thrown:
>Fatal error: Uncaught Error: Class name must be a valid object or a string on line 279
This change:
* Adds a simple test for the `Text_Diff::_check()` method, which is how the bug was discovered as the test could never pass with the code as-is.
* Adds a defensive guard to protect against the fatal. It checks if `$prevtype` is not `null` as a pre-condition to for checking the instance. This bugfix also resolves the failing test.
Follow-up to [49194], [7747].
Props jrf, hellofromTonya.
See #62083.
Built from https://develop.svn.wordpress.org/trunk@59070
git-svn-id: http://core.svn.wordpress.org/trunk@58466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.
In this case, the properties, as used in the class methods, fall in the “known property” category.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [53942], [53948], [53949], [53952], [53953], [53954], [53957], [54037].
Props jrf, thomask.
See #58298.
Built from https://develop.svn.wordpress.org/trunk@55752
git-svn-id: http://core.svn.wordpress.org/trunk@55264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes#38913.
See #39176.
Built from https://develop.svn.wordpress.org/trunk@52978
git-svn-id: http://core.svn.wordpress.org/trunk@52567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Add `phpcs:ignore` statements to compatibility checks in PHPMailer.
- Remove quotes around the assertion in an `assert()` call. This will trigger a deprecated notice under certain conditions on PHP 7.2.
Props jrf, desrosj.
See #49922, #48033.
Built from https://develop.svn.wordpress.org/trunk@48045
git-svn-id: http://core.svn.wordpress.org/trunk@47812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors. The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).
This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used. In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."
Upstream: https://wiki.php.net/rfc/remove_php4_constructors
Props jdgrimes, netweb, jorbin
See #31982
Built from https://develop.svn.wordpress.org/trunk@32990
git-svn-id: http://core.svn.wordpress.org/trunk@32961 1a063a9b-81f0-0310-95a4-ce76da25c4cd