Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ext/standard/tests/general_functions/gh20727.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
GH-20727 (User code can run after module request shutdown via the output layer)
--FILE--
<?php
putenv('foo=baz');
header_register_callback(function(){
var_dump(putenv('foo=bar'));
});
?>
--EXPECT--
bool(true)
12 changes: 6 additions & 6 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down