Skip to content

Commit 679a48e

Browse files
committed
Revert "force exit after php shutdown/cleanup ran"
This reverts commit 5aff0c9.
1 parent cd5a82e commit 679a48e

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

frankenphp.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,13 @@ PHP_FUNCTION(frankenphp_handle_request) {
606606
}
607607
}
608608

609-
frankenphp_worker_request_shutdown();
610609
#ifndef PHP_WIN32
611610
if (is_forked_child) {
612611
_exit(0);
613612
}
614613
#endif
614+
615+
frankenphp_worker_request_shutdown();
615616
go_frankenphp_finish_worker_request(thread_index, callback_ret);
616617
if (result.r1 != NULL) {
617618
zval_ptr_dtor(result.r1);
@@ -1099,6 +1100,11 @@ static void *php_thread(void *arg) {
10991100

11001101
/* Execute the PHP script, potential bailout to zend_catch */
11011102
php_execute_script(&file_handle);
1103+
#ifndef PHP_WIN32
1104+
if (is_forked_child) {
1105+
_exit(EG(exit_status));
1106+
}
1107+
#endif
11021108
zend_destroy_file_handle(&file_handle);
11031109
reset_sandboxed_environment();
11041110

@@ -1111,15 +1117,16 @@ static void *php_thread(void *arg) {
11111117
/* shutdown the request, potential bailout to zend_catch */
11121118
php_request_shutdown((void *)0);
11131119
frankenphp_free_request_context();
1114-
#ifndef PHP_WIN32
1115-
if (is_forked_child) {
1116-
_exit(EG(exit_status));
1117-
}
1118-
#endif
11191120
go_frankenphp_after_script_execution(thread_index, EG(exit_status));
11201121
}
11211122
}
11221123
zend_catch {
1124+
#ifndef PHP_WIN32
1125+
if (is_forked_child) {
1126+
_exit(EG(exit_status));
1127+
}
1128+
#endif
1129+
11231130
/* Critical failure from php_execute_script or php_request_shutdown, mark
11241131
* the thread as unhealthy */
11251132
thread_is_healthy = false;
@@ -1139,11 +1146,6 @@ static void *php_thread(void *arg) {
11391146
PG(last_error_file) = NULL;
11401147
}
11411148
frankenphp_free_request_context();
1142-
#ifndef PHP_WIN32
1143-
if (is_forked_child) {
1144-
_exit(EG(exit_status));
1145-
}
1146-
#endif
11471149
go_frankenphp_after_script_execution(thread_index, EG(exit_status));
11481150
}
11491151
zend_end_try();

0 commit comments

Comments
 (0)