External Libraries: Skip instanceof check when null in Text_Diff::_check().
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
This commit is contained in:
parent
b58cc4d2b0
commit
4ab4b38ecd
|
@ -276,7 +276,7 @@ class Text_Diff {
|
|||
|
||||
$prevtype = null;
|
||||
foreach ($this->_edits as $edit) {
|
||||
if ($edit instanceof $prevtype) {
|
||||
if ($prevtype !== null && $edit instanceof $prevtype) {
|
||||
trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
|
||||
}
|
||||
$prevtype = get_class($edit);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-59069';
|
||||
$wp_version = '6.7-alpha-59070';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue