Skip to content

Commit

Permalink
Fix phpGH-12232: FPM: segfault dynamically loading extension without …
Browse files Browse the repository at this point in the history
…opache
  • Loading branch information
bukka committed Sep 17, 2023
1 parent 55ed769 commit da22696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Zend/zend_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct _zend_compiler_globals {
bool multibyte;
bool detect_unicode;
bool encoding_declared;
bool interned_strings_initialized;

zend_ast *ast;
zend_arena *ast_arena;
Expand Down
4 changes: 4 additions & 0 deletions Zend/zend_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ static zend_string* ZEND_FASTCALL zend_new_interned_string_request(zend_string *
return ret;
}

if (!CG(interned_strings_initialized)) {
zend_interned_strings_activate();
}
ret = zend_interned_string_ht_lookup(str, &CG(interned_strings));
if (ret) {
zend_string_release(str);
Expand Down Expand Up @@ -339,6 +342,7 @@ static zend_string* ZEND_FASTCALL zend_string_init_existing_interned_request(con
ZEND_API void zend_interned_strings_activate(void)
{
zend_init_interned_strings_ht(&CG(interned_strings), 0);
CG(interned_strings_initialized) = true;
}

ZEND_API void zend_interned_strings_deactivate(void)
Expand Down

0 comments on commit da22696

Please sign in to comment.