Skip to content

Commit 272dc9a

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
2 parents 31bd628 + af77d3b commit 272dc9a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.10
44

5+
- CLI:
6+
. Fixed bug GH-11716 (cli server crashes on SIGINT when compiled with
7+
ZEND_RC_DEBUG=1). (nielsdos)
8+
59
- FFI:
610
. Fix leaking definitions when using FFI::cdef()->new(...). (ilutov)
711

Zend/zend_hash.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,11 @@ static zend_always_inline zval *_zend_hash_str_add_or_update_i(HashTable *ht, co
888888
ht->nNumOfElements++;
889889
p = ht->arData + idx;
890890
p->key = key = zend_string_init(str, len, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
891+
#if ZEND_RC_DEBUG
892+
if (GC_FLAGS(ht) & GC_PERSISTENT_LOCAL) {
893+
GC_MAKE_PERSISTENT_LOCAL(key);
894+
}
895+
#endif
891896
p->h = ZSTR_H(key) = h;
892897
HT_FLAGS(ht) &= ~HASH_FLAG_STATIC_KEYS;
893898
if (flag & HASH_LOOKUP) {

sapi/cli/php_cli_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,9 @@ static void php_cli_server_request_ctor(php_cli_server_request *req) /* {{{ */
13811381
req->query_string_len = 0;
13821382
zend_hash_init(&req->headers, 0, NULL, cli_header_value_dtor, 1);
13831383
/* No destructor is registered as the value pointed by is the same as for &req->headers */
1384+
GC_MAKE_PERSISTENT_LOCAL(&req->headers);
13841385
zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1);
1386+
GC_MAKE_PERSISTENT_LOCAL(&req->headers_original_case);
13851387
req->content = NULL;
13861388
req->content_len = 0;
13871389
req->ext = NULL;
@@ -2312,6 +2314,7 @@ static void php_cli_server_mime_type_ctor(php_cli_server *server, const php_cli_
23122314
const php_cli_server_ext_mime_type_pair *pair;
23132315

23142316
zend_hash_init(&server->extension_mime_types, 0, NULL, NULL, 1);
2317+
GC_MAKE_PERSISTENT_LOCAL(&server->extension_mime_types);
23152318

23162319
for (pair = mime_type_map; pair->ext; pair++) {
23172320
size_t ext_len = strlen(pair->ext);

0 commit comments

Comments
 (0)