mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Set EG(active)=0 during preloading shutdown
Just like during normal shutdown, we should set EG(active)=0 during the partial preloading shutdown, to make sure that no user code can run. We need to slightly tweak inheritance class loading to still pick the right code path.
This commit is contained in:
parent
99ddc806dc
commit
4bb66ddc76
2 changed files with 5 additions and 2 deletions
|
@ -228,8 +228,9 @@ static zend_always_inline void register_unresolved_class(zend_string *name) {
|
|||
static zend_class_entry *lookup_class_ex(
|
||||
zend_class_entry *scope, zend_string *name, bool register_unresolved) {
|
||||
zend_class_entry *ce;
|
||||
bool in_preload = CG(compiler_options) & ZEND_COMPILE_PRELOAD;
|
||||
|
||||
if (UNEXPECTED(!EG(active))) {
|
||||
if (UNEXPECTED(!EG(active) && !in_preload)) {
|
||||
zend_string *lc_name = zend_string_tolower(name);
|
||||
|
||||
ce = zend_hash_find_ptr(CG(class_table), lc_name);
|
||||
|
@ -248,7 +249,7 @@ static zend_class_entry *lookup_class_ex(
|
|||
ce = zend_lookup_class_ex(
|
||||
name, NULL, ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD);
|
||||
|
||||
if (!CG(in_compilation) || (CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
|
||||
if (!CG(in_compilation) || in_preload) {
|
||||
if (ce) {
|
||||
return ce;
|
||||
}
|
||||
|
|
|
@ -4448,6 +4448,8 @@ static int accel_preload(const char *config, bool in_child)
|
|||
php_output_end_all();
|
||||
php_free_shutdown_functions();
|
||||
|
||||
EG(active) = 0;
|
||||
|
||||
/* Release stored values to avoid dangling pointers */
|
||||
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
|
||||
zend_hash_init(&EG(symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue