-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-17201: Dom\TokenList issues with interned string replace
If a bucket previously had a non-interned string, and is now replaced with an interned string, then the type flags still incorrectly state it's a non-interned string. This leads to the refcount being edited for interned strings, which in turn can lead to a crash when protect_memory is set. Closes GH-17207.
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
GH-17201 (Dom\TokenList issues with interned string replace) | ||
--EXTENSIONS-- | ||
dom | ||
--INI-- | ||
opcache.protect_memory=1 | ||
--FILE-- | ||
<?php | ||
$dom = DOM\XMLDocument::createFromString('<root class="AA B C"/>'); | ||
$element = $dom->documentElement; | ||
$list = $element->classList; | ||
$list->replace('AA', 'AB'); // Use interned string | ||
foreach ($list as $entry) { | ||
var_dump($entry); | ||
} | ||
?> | ||
--EXPECT-- | ||
string(2) "AB" | ||
string(1) "B" | ||
string(1) "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters