Commit a38c852
authored
Guard fclose() against false stream in supercache-only mode (#1053)
* Guard fclose() against false stream in supercache-only mode
In supercache-only mode $fr is false (the wp-cache file is never opened). When the supercache temp file fails to open, the error branches called @fclose( $fr ) = @fclose( false ). On PHP 8+ that is a TypeError, which @ does not suppress, so the request fatals. Only call fclose() when the stream is open.
Fixes #1016.
* Silence AlternativeFunctions warning on guarded fclose calls
phpcs-changed flags the now-modified fclose() lines under WordPress.WP.AlternativeFunctions; match the file's existing inline-ignore convention for direct filesystem calls.1 parent ed5d373 commit a38c852
1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2418 | 2418 | | |
2419 | 2419 | | |
2420 | 2420 | | |
2421 | | - | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
2422 | 2424 | | |
2423 | 2425 | | |
2424 | 2426 | | |
| |||
2430 | 2432 | | |
2431 | 2433 | | |
2432 | 2434 | | |
2433 | | - | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
2434 | 2438 | | |
2435 | 2439 | | |
2436 | 2440 | | |
| |||
0 commit comments