Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037393 | mantisbt | plug-ins | public | 2026-09-16 13:58 | 2026-09-17 18:20 |
| Reporter | 123 | Assigned To | community | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | assigned | Resolution | open | ||
| Product Version | 2.27.1 | ||||
| Target Version | 2.29.0 | ||||
| Summary | 0037393: plugin_file.php sends a gzip body with 304 Not Modified, which strict HTTP servers (Caddy) reject | ||||
| Description | plugin_file_include() (core/plugin_api.php) answers a matching If-Modified-Since with 304 Not Modified and no output. However, compress_handler_is_enabled() (core/compress_api.php) has already switched on zlib.output_compression via ini_set(), and PHP's zlib output handler emits a gzip stream (20 bytes: header, empty deflate block, trailer) even for an empty buffer. The raw response from php-fpm is: Status: 304 Not Modified <20 bytes of gzip> {"level":"warn","logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response", Steps To Reproduce: Additional Information: | ||||
| Steps To Reproduce | MantisBT 2.28.4 (the code in master is the same), PHP 8.4 php-fpm, $g_compress_html = ON (default), zlib.output_compression = Off in php.ini (default), served by Caddy over HTTP/2. curl --http2 -H 'Accept-Encoding: gzip' \ Talking to php-fpm directly shows the offending body: SCRIPT_FILENAME=/path/to/mantisbt/plugin_file.php SCRIPT_NAME=/plugin_file.php \ | ||||
| Additional Information | Fix: compress_disable() only clears $g_compression_started, which has no effect on the zlib.output_compression path. Make it also turn zlib.output_compression off while the headers are still unsent, and call it in plugin_file_include() before sending the 304. Turning zlib.output_compression off at runtime keeps already-buffered output and flushes it uncompressed, so the other caller (error_api.php) is unaffected. Verified on PHP 8.4 / php-fpm / Caddy: the 304 is sent with an empty body, a stale If-Modified-Since still returns 200 with the file, regular pages are still gzip-compressed. Pull request: https://github.com/mantisbt/mantisbt/pull/2284 | ||||
| Tags | No tags attached. | ||||
related to
child of
duplicate of