Skip to content

Commit b0a7b51

Browse files
committed
Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
1 parent ee3f932 commit b0a7b51

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Zend/zend_hash.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ static zend_always_inline zval *_zend_hash_str_add_or_update_i(HashTable *ht, co
878878
ht->nNumOfElements++;
879879
p = ht->arData + idx;
880880
p->key = key = zend_string_init(str, len, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
881+
#if ZEND_RC_DEBUG
882+
if (GC_FLAGS(ht) & GC_PERSISTENT_LOCAL) {
883+
GC_MAKE_PERSISTENT_LOCAL(key);
884+
}
885+
#endif
881886
p->h = ZSTR_H(key) = h;
882887
HT_FLAGS(ht) &= ~HASH_FLAG_STATIC_KEYS;
883888
if (flag & HASH_LOOKUP) {

sapi/cli/php_cli_server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,6 +2248,7 @@ static int php_cli_server_mime_type_ctor(php_cli_server *server, const php_cli_s
22482248
const php_cli_server_ext_mime_type_pair *pair;
22492249

22502250
zend_hash_init(&server->extension_mime_types, 0, NULL, NULL, 1);
2251+
GC_MAKE_PERSISTENT_LOCAL(&server->extension_mime_types);
22512252

22522253
for (pair = mime_type_map; pair->ext; pair++) {
22532254
size_t ext_len = strlen(pair->ext);

0 commit comments

Comments
 (0)