mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Since GH-15021 preloaded constants are propagated to compiled scripts. This is problematic for file cache, which assumes all referenced zvals are either persistently allocated or local to the current script. However, preloaded constants live in shm as immutable, but not persistent. To solve this, we'd need to duplicate propagated constants in the optimizer when file cache is used. This is error prone given it needs to happen in many places. It's debatable whether constant propagation is even correct in this case, as running the preloaded script on a restart isn't guaranteed to produce the same result. Hence, avoid the issue for now by just not relying on preloaded symbols when file cache is used. Fixes GH-21052 Closes GH-21281
33 lines
521 B
PHP
33 lines
521 B
PHP
--TEST--
|
|
GH-21052: Preloaded constant erroneously propagated to file-cached script
|
|
--CREDITS--
|
|
Grummfy
|
|
--EXTENSIONS--
|
|
opcache
|
|
--INI--
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.file_cache="{TMP}"
|
|
opcache.preload={PWD}/gh21052_a.inc
|
|
--SKIPIF--
|
|
<?php
|
|
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
require __DIR__ . '/gh21052_b.inc';
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
[0]=>
|
|
string(3) "foo"
|
|
}
|
|
array(1) {
|
|
[0]=>
|
|
string(3) "foo"
|
|
}
|
|
array(1) {
|
|
[0]=>
|
|
string(3) "foo"
|
|
}
|