PHP Version
8.5
CodeIgniter4 Version
4.7.2
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
FrankenPHP Worker Mode
Environment
development
Database
Not database-related
What happened?
Requests can fail during the pre_system event before the controller is reached.
The response is a 500 with:
Your zlib.output_compression ini directive is turned on. This will not work well with output buffers.
The exception is thrown by the app starter’s app/Config/Events.php zlib guard:
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
The issue is that ini_get('zlib.output_compression') may return valid disabled values such as "Off". Since "Off" is a non-empty string, the current loose truthiness check treats it as enabled.
Steps to Reproduce
The relevant PHP behavior can be reproduced directly:
php -r 'ini_set("zlib.output_compression", "Off"); var_dump(ini_get("zlib.output_compression"), (bool) ini_get("zlib.output_compression"));'
Output:
string(3) "Off"
bool(true)
In a CodeIgniter app, if the runtime value is "Off", the app starter guard rejects the request even though zlib.output_compression is disabled.
Expected Output
The zlib guard should reject enabled values, but allow valid disabled values such as:
Anything else?
The fix is to parse the ini_get('zlib.output_compression') value.
PHP Version
8.5
CodeIgniter4 Version
4.7.2
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter)Which operating systems have you tested for this bug?
Linux
Which server did you use?
FrankenPHP Worker Mode
Environment
development
Database
Not database-related
What happened?
Requests can fail during the
pre_systemevent before the controller is reached.The response is a
500with:The exception is thrown by the app starter’s
app/Config/Events.phpzlib guard:The issue is that
ini_get('zlib.output_compression')may return valid disabled values such as"Off". Since"Off"is a non-empty string, the current loose truthiness check treats it as enabled.Steps to Reproduce
The relevant PHP behavior can be reproduced directly:
php -r 'ini_set("zlib.output_compression", "Off"); var_dump(ini_get("zlib.output_compression"), (bool) ini_get("zlib.output_compression"));'Output:
In a CodeIgniter app, if the runtime value is
"Off", the app starter guard rejects the request even thoughzlib.output_compressionis disabled.Expected Output
The zlib guard should reject enabled values, but allow valid disabled values such as:
Anything else?
The fix is to parse the
ini_get('zlib.output_compression')value.