diff --git a/ext/standard/tests/general_functions/gh20727.phpt b/ext/standard/tests/general_functions/gh20727.phpt new file mode 100644 index 0000000000000..f5d8f69dadf96 --- /dev/null +++ b/ext/standard/tests/general_functions/gh20727.phpt @@ -0,0 +1,11 @@ +--TEST-- +GH-20727 (User code can run after module request shutdown via the output layer) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/main/main.c b/main/main.c index f190eab3d094f..7c45782807f18 100644 --- a/main/main.c +++ b/main/main.c @@ -1997,16 +1997,16 @@ void php_request_shutdown(void *dummy) zend_unset_timeout(); } zend_end_try(); - /* 5. Call all extensions RSHUTDOWN functions */ - if (PG(modules_activated)) { - zend_deactivate_modules(); - } - - /* 6. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ + /* 5. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ zend_try { php_output_deactivate(); } zend_end_try(); + /* 6. Call all extensions RSHUTDOWN functions */ + if (PG(modules_activated)) { + zend_deactivate_modules(); + } + /* 7. Free shutdown functions */ if (PG(modules_activated)) { php_free_shutdown_functions();