File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -274,9 +274,9 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
274
274
zval * zv ;
275
275
276
276
EG (flags ) |= EG_FLAGS_IN_RESOURCE_SHUTDOWN ;
277
- zend_try {
277
+ // zend_try {
278
278
zend_close_rsrc_list (& EG (regular_list ));
279
- } zend_end_try ();
279
+ // } zend_end_try();
280
280
281
281
/* No PHP callback functions should be called after this point. */
282
282
EG (active ) = 0 ;
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ void zend_close_rsrc_list(HashTable *ht)
217
217
/* Reload ht->arData on each iteration, as it may be reallocated. */
218
218
uint32_t i = ht -> nNumUsed ;
219
219
220
+ #if 0
220
221
retry :
221
222
zend_try {
222
223
while (i -- > 0 ) {
@@ -236,6 +237,23 @@ void zend_close_rsrc_list(HashTable *ht)
236
237
* has already shut down and the process would crash. */
237
238
goto retry ;
238
239
} zend_end_try ();
240
+ #endif
241
+ while (i -- > 0 ) {
242
+ zval * p = ZEND_HASH_ELEMENT (ht , i );
243
+ if (Z_TYPE_P (p ) != IS_UNDEF ) {
244
+ zend_resource * res = Z_PTR_P (p );
245
+ if (res -> type >= 0 ) {
246
+ /* If we have bailed, we probably executed user code (e.g. user stream
247
+ * API). Keep closing resources so they don't leak. User handlers must be
248
+ * called now so they aren't called in zend_deactivate() on
249
+ * zend_destroy_rsrc_list(&EG(regular_list)). At that point, the executor
250
+ * has already shut down and the process would crash. */
251
+ zend_try {
252
+ zend_resource_dtor (res );
253
+ } zend_end_try ();
254
+ }
255
+ }
256
+ }
239
257
}
240
258
241
259
You can’t perform that action at this time.
0 commit comments