From e97af52b4f43af911bd62fcbf6d29963f521e99d Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Fri, 27 Sep 2024 18:19:17 +0000 Subject: [PATCH] Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation in Text_Diff_Op::reverse(). 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 --- wp-includes/Text/Diff.php | 7 ++----- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php index 0f13b0fe5a..1d5b3859c5 100644 --- a/wp-includes/Text/Diff.php +++ b/wp-includes/Text/Diff.php @@ -350,15 +350,12 @@ class Text_MappedDiff extends Text_Diff { * * @access private */ -class Text_Diff_Op { +abstract class Text_Diff_Op { var $orig; var $final; - function &reverse() - { - trigger_error('Abstract method', E_USER_ERROR); - } + abstract function &reverse(); function norig() { diff --git a/wp-includes/version.php b/wp-includes/version.php index ba3dd2d24b..0c86cc481b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-59105'; +$wp_version = '6.7-alpha-59106'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.