Skip to content

Commit 432824e

Browse files
fix: ensure env is not in an invalid state on shutdown (#1442)
1 parent 9cca128 commit 432824e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

frankenphp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ static zend_module_entry frankenphp_module = {
501501
STANDARD_MODULE_PROPERTIES};
502502

503503
static void frankenphp_request_shutdown() {
504+
if (is_worker_thread) {
505+
/* ensure $_ENV is not in an invalid state before shutdown */
506+
zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_ENV]);
507+
array_init(&PG(http_globals)[TRACK_VARS_ENV]);
508+
}
504509
php_request_shutdown((void *)0);
505510
frankenphp_free_request_context();
506511
}

0 commit comments

Comments
 (0)