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
This commit is contained in:
Niels Dossche 2023-07-21 15:31:20 +02:00
commit 272dc9a09c
3 changed files with 12 additions and 0 deletions

4
NEWS
View file

@ -2,6 +2,10 @@ PHP NEWS
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.2.10 ?? ??? ????, PHP 8.2.10
- CLI:
. Fixed bug GH-11716 (cli server crashes on SIGINT when compiled with
ZEND_RC_DEBUG=1). (nielsdos)
- FFI: - FFI:
. Fix leaking definitions when using FFI::cdef()->new(...). (ilutov) . Fix leaking definitions when using FFI::cdef()->new(...). (ilutov)

View file

@ -888,6 +888,11 @@ add_to_hash:
ht->nNumOfElements++; ht->nNumOfElements++;
p = ht->arData + idx; p = ht->arData + idx;
p->key = key = zend_string_init(str, len, GC_FLAGS(ht) & IS_ARRAY_PERSISTENT); 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; p->h = ZSTR_H(key) = h;
HT_FLAGS(ht) &= ~HASH_FLAG_STATIC_KEYS; HT_FLAGS(ht) &= ~HASH_FLAG_STATIC_KEYS;
if (flag & HASH_LOOKUP) { if (flag & HASH_LOOKUP) {

View file

@ -1381,7 +1381,9 @@ static void php_cli_server_request_ctor(php_cli_server_request *req) /* {{{ */
req->query_string_len = 0; req->query_string_len = 0;
zend_hash_init(&req->headers, 0, NULL, cli_header_value_dtor, 1); zend_hash_init(&req->headers, 0, NULL, cli_header_value_dtor, 1);
/* No destructor is registered as the value pointed by is the same as for &req->headers */ /* No destructor is registered as the value pointed by is the same as for &req->headers */
GC_MAKE_PERSISTENT_LOCAL(&req->headers);
zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1); zend_hash_init(&req->headers_original_case, 0, NULL, NULL, 1);
GC_MAKE_PERSISTENT_LOCAL(&req->headers_original_case);
req->content = NULL; req->content = NULL;
req->content_len = 0; req->content_len = 0;
req->ext = NULL; req->ext = NULL;
@ -2312,6 +2314,7 @@ static void php_cli_server_mime_type_ctor(php_cli_server *server, const php_cli_
const php_cli_server_ext_mime_type_pair *pair; const php_cli_server_ext_mime_type_pair *pair;
zend_hash_init(&server->extension_mime_types, 0, NULL, NULL, 1); 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++) { for (pair = mime_type_map; pair->ext; pair++) {
size_t ext_len = strlen(pair->ext); size_t ext_len = strlen(pair->ext);