mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Handle bailouts during preload linking
This commit is contained in:
@@ -3850,7 +3850,14 @@ static int accel_preload(const char *config)
|
||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
|
||||
zend_hash_init(&EG(symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
preload_link();
|
||||
/* Inheritance errors may be thrown during linking */
|
||||
zend_try {
|
||||
preload_link();
|
||||
} zend_catch {
|
||||
ret = FAILURE;
|
||||
goto finish;
|
||||
} zend_end_try();
|
||||
|
||||
preload_remove_empty_includes();
|
||||
|
||||
/* Don't preload constants */
|
||||
@@ -3940,6 +3947,7 @@ static int accel_preload(const char *config)
|
||||
zend_shared_alloc_destroy_xlat_table();
|
||||
}
|
||||
|
||||
finish:
|
||||
zend_hash_destroy(preload_scripts);
|
||||
efree(preload_scripts);
|
||||
preload_scripts = NULL;
|
||||
|
||||
15
ext/opcache/tests/preload_006.phpt
Normal file
15
ext/opcache/tests/preload_006.phpt
Normal file
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Handling of errors during linking
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/preload_inheritance_error_ind.inc
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Foobar\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Fatal error: Declaration of B::foo($bar) must be compatible with A::foo() in Unknown on line 0
|
||||
9
ext/opcache/tests/preload_inheritance_error.inc
Normal file
9
ext/opcache/tests/preload_inheritance_error.inc
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
interface A {
|
||||
public function foo();
|
||||
}
|
||||
|
||||
class B implements A {
|
||||
public function foo($bar) {}
|
||||
}
|
||||
2
ext/opcache/tests/preload_inheritance_error_ind.inc
Normal file
2
ext/opcache/tests/preload_inheritance_error_ind.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
opcache_compile_file(__DIR__ . '/preload_inheritance_error.inc');
|
||||
Reference in New Issue
Block a user