mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Don't assume that all includes have been executed
This commit is contained in:
@@ -3565,7 +3565,7 @@ static void preload_remove_empty_includes(void)
|
||||
if (resolved_path) {
|
||||
zend_persistent_script *incl = zend_hash_find_ptr(preload_scripts, resolved_path);
|
||||
zend_string_release(resolved_path);
|
||||
if (!incl->empty) {
|
||||
if (!incl || !incl->empty) {
|
||||
empty = 0;
|
||||
break;
|
||||
}
|
||||
@@ -3604,7 +3604,7 @@ static void preload_remove_empty_includes(void)
|
||||
|
||||
if (resolved_path) {
|
||||
zend_persistent_script *incl = zend_hash_find_ptr(preload_scripts, resolved_path);
|
||||
if (incl->empty) {
|
||||
if (incl && incl->empty) {
|
||||
MAKE_NOP(opline);
|
||||
} else {
|
||||
if (!IS_ABSOLUTE_PATH(Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), Z_STRLEN_P(RT_CONSTANT(opline, opline->op1)))) {
|
||||
|
||||
15
ext/opcache/tests/preload_007.phpt
Normal file
15
ext/opcache/tests/preload_007.phpt
Normal file
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Handling of includes that were not executed
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/preload_include.inc
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Foobar";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Foobar
|
||||
7
ext/opcache/tests/preload_include.inc
Normal file
7
ext/opcache/tests/preload_include.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
$b = 2;
|
||||
if ($a == $b) {
|
||||
include __DIR__ . "/preload_include_dummy.inc";
|
||||
}
|
||||
3
ext/opcache/tests/preload_include_dummy.inc
Normal file
3
ext/opcache/tests/preload_include_dummy.inc
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo "Dummy\n";
|
||||
Reference in New Issue
Block a user