Skip to content

Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1 #11757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Zend/zend_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ static zend_always_inline zval *_zend_hash_str_add_or_update_i(HashTable *ht, co
ht->nNumOfElements++;
p = ht->arData + idx;
p->key = key = zend_string_init(str, len, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
#if ZEND_RC_DEBUG
if (GC_FLAGS(ht) & GC_PERSISTENT_LOCAL) {
GC_MAKE_PERSISTENT_LOCAL(key);
}
#endif
p->h = ZSTR_H(key) = h;
HT_FLAGS(ht) &= ~HASH_FLAG_STATIC_KEYS;
if (flag & HASH_LOOKUP) {
Expand Down
3 changes: 3 additions & 0 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,9 @@ static int php_cli_server_request_ctor(php_cli_server_request *req) /* {{{ */
req->query_string = NULL;
req->query_string_len = 0;
zend_hash_init(&req->headers, 0, NULL, char_ptr_dtor_p, 1);
GC_MAKE_PERSISTENT_LOCAL(&req->headers);
zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1);
GC_MAKE_PERSISTENT_LOCAL(&req->headers_original_case);
req->content = NULL;
req->content_len = 0;
req->ext = NULL;
Expand Down Expand Up @@ -2248,6 +2250,7 @@ static int php_cli_server_mime_type_ctor(php_cli_server *server, const php_cli_s
const php_cli_server_ext_mime_type_pair *pair;

zend_hash_init(&server->extension_mime_types, 0, NULL, NULL, 1);
GC_MAKE_PERSISTENT_LOCAL(&server->extension_mime_types);

for (pair = mime_type_map; pair->ext; pair++) {
size_t ext_len = strlen(pair->ext);
Expand Down