We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 99e6b0e + db3f6d0 commit be28894Copy full SHA for be28894
2 files changed
ext/mbstring/mbstring.c
@@ -1160,8 +1160,8 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
1160
MBSTRG(outconv_state) = 0;
1161
1162
if (MBSTRG(all_encodings_list)) {
1163
- GC_DELREF(MBSTRG(all_encodings_list));
1164
- 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));
1165
MBSTRG(all_encodings_list) = NULL;
1166
}
1167
ext/mbstring/tests/gh19397.phpt
@@ -0,0 +1,11 @@
1
+--TEST--
2
+GH-19397 (mb_list_encodings() can cause crashes on shutdown)
3
+--EXTENSIONS--
4
+mbstring
5
+--FILE--
6
+<?php
7
+$doNotDeleteThisVariableAssignment = mb_list_encodings();
8
+var_dump(count($doNotDeleteThisVariableAssignment) > 0);
9
+?>
10
+--EXPECT--
11
+bool(true)
0 commit comments