티스토리 수익 글 보기

티스토리 수익 글 보기

Code Modernization: Fix trigger_error() with E_USER_ERROR deprecation… · WordPress/WordPress@e97af52 · GitHub
Skip to content

Commit e97af52

Browse files
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
1 parent 65d2764 commit e97af52

File tree

2 files changed

+3
6
lines changed

2 files changed

+3
6
lines changed

wp-includes/Text/Diff.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,12 @@ public function Text_MappedDiff( $from_lines, $to_lines,
350350
*
351351
* @access private
352352
*/
353-
class Text_Diff_Op {
353+
abstract class Text_Diff_Op {
354354

355355
var $orig;
356356
var $final;
357357

358-
function &reverse()
359-
{
360-
trigger_error('Abstract method', E_USER_ERROR);
361-
}
358+
abstract function &reverse();
362359

363360
function norig()
364361
{

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '6.7-alpha-59105';
19+
$wp_version = '6.7-alpha-59106';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)