mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
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.
21 lines
428 B
PHP
21 lines
428 B
PHP
--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"
|