mirror of
https://github.com/php/php-src.git
synced 2026-03-25 16:52:18 +01:00
Literal compaction was incorrectly assuming that literals with the same base literal and the same number of related literals would be equal. Maybe that was the case historically, but at least it isn't true in PHP 8, where FETCH_CONSTANT and INIT_METHOD have distinct literals at the second position. Fix this by making the cache key a concatenation of all literals, rather than just the base literal. We still distinguish the number of related literals based on a bias added to the string hash.
20 lines
257 B
PHP
20 lines
257 B
PHP
--TEST--
|
|
Bug #81046: Literal compaction merges non-equal related literals
|
|
--FILE--
|
|
<?php
|
|
|
|
class Test {
|
|
static function methoD() {
|
|
echo "Method called\n";
|
|
}
|
|
}
|
|
|
|
const methoD = 1;
|
|
var_dump(methoD);
|
|
test::methoD();
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(1)
|
|
Method called
|