Opened 22 months ago
Closed 22 months ago
#62083 closed defect (bug) (fixed)
Text_Diff::_check() throws a fatal error when $prevtype is null.
| Reported by: | hellofromTonya | Owned by: | hellofromTonya |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.7 |
| Component: | External Libraries | Version: | 5.6 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
Text_Diff::_check() will throw a fatal error when $prevtype is null.
Fatal error: Uncaught Error: Class name must be a valid object or a string
instanceof requires the class name's term to be an object or string.
See it in action here https://3v4l.org/rQ0s4#veol.
Looking at the existing code (using the 6.6.2 tagged version as its the latest release as of this ticket),
$prevtype = null;
foreach ($this->_edits as $edit) {
if ($edit instanceof $prevtype) {
trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
}
$prevtype = get_class($edit);
}
this means $prevtype must be an object or string. On the first loop, $prevtype is null.
For contextual history, [49194] changed from get_class() to instanceof.
Reference:
Change History (5)
#1
@
22 months ago
- Keywords has-patch has-unit-tests commit added
- Owner set to
- Status assigned → reviewing
#3
follow-up:
↓ 4
@
22 months ago
- Keywords commit removed
Ticket/report maintenance following the earlier commit. I've left it on the milestone, @hellofromTonya are you able to bump it if you don't think the rest of the patch will make it?
#4
in reply to: ↑ 3
;
follow-up:
↓ 5
@
22 months ago
Replying to peterwilsoncc:
Ticket/report maintenance following the earlier commit. I've left it on the milestone, @hellofromTonya are you able to bump it if you don't think the rest of the patch will make it?
The rest of the patch belong with another ticket (#62061), so I think this ticket can be closed (as solved).
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch: https://github.com/WordPress/wordpress-develop/pull/7375/commits/5b0db944a16fdcc0db1c14a445715e1029d2c672
This specific commit in PR 7375 adds a test and fixes the bug. Props to @jrf for its discovery and the patch.