Commit f95433a
committed
Fix GH-20727: User code can run after module request shutdown via the output layer
If user code runs after modules executed RSHUTDOWN, it can be dangerous
because user code can rely on module globals that have already been
invalidated.
We should not run user code after RSHUTDOWN.
This is shown by the test by using putenv(). The original report
demonstrated a silent failure via mbstring. There are more test cases
possible but this is by far the simplest.
An alternative solution would be to try to separate the user code
running via php_header() from the output layer shutdown, to make sure
user code runs earlier. However, that becomes an ugly complex solution.
This PR's solution keeps things simple but this can be a BC break if
extensions produce output in their RSHUTDOWN handler (However, that may
have been unsafe in the first place).1 parent db65503 commit f95433a
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments