Skip to content

Commit cf064de

Browse files
committed
That also failed CI, what about this?
1 parent 9417492 commit cf064de

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Zend/zend_execute_API.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
274274
zval *zv;
275275

276276
EG(flags) |= EG_FLAGS_IN_RESOURCE_SHUTDOWN;
277-
zend_try {
277+
// zend_try {
278278
zend_close_rsrc_list(&EG(regular_list));
279-
} zend_end_try();
279+
// } zend_end_try();
280280

281281
/* No PHP callback functions should be called after this point. */
282282
EG(active) = 0;

Zend/zend_list.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ void zend_close_rsrc_list(HashTable *ht)
217217
/* Reload ht->arData on each iteration, as it may be reallocated. */
218218
uint32_t i = ht->nNumUsed;
219219

220+
#if 0
220221
retry:
221222
zend_try {
222223
while (i-- > 0) {
@@ -236,6 +237,23 @@ void zend_close_rsrc_list(HashTable *ht)
236237
* has already shut down and the process would crash. */
237238
goto retry;
238239
} 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+
}
239257
}
240258

241259

0 commit comments

Comments
 (0)