Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix GH-19397: mb_list_encodings() can cause crashes on shutdown
This commit is contained in:
Niels Dossche 2025-08-08 20:33:00 +02:00
commit be2889411a
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 13 additions and 2 deletions

View file

@ -1160,8 +1160,8 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
MBSTRG(outconv_state) = 0;
if (MBSTRG(all_encodings_list)) {
GC_DELREF(MBSTRG(all_encodings_list));
zend_array_destroy(MBSTRG(all_encodings_list));
/* must be *array* release to remove from GC root buffer and free the hashtable itself */
zend_array_release(MBSTRG(all_encodings_list));
MBSTRG(all_encodings_list) = NULL;
}

View file

@ -0,0 +1,11 @@
--TEST--
GH-19397 (mb_list_encodings() can cause crashes on shutdown)
--EXTENSIONS--
mbstring
--FILE--
<?php
$doNotDeleteThisVariableAssignment = mb_list_encodings();
var_dump(count($doNotDeleteThisVariableAssignment) > 0);
?>
--EXPECT--
bool(true)