Better fix for system.cache.gzip: true

This commit is contained in:
Matias Griese 2022-03-23 15:47:45 +02:00
parent 8f0443a73d
commit c9c23c6c4f
3 changed files with 25 additions and 6 deletions

View File

@ -12,7 +12,7 @@
- `text`, `url`, `hidden`, `commalist`: 2048
- `text` (multiline), `textarea`: 65536
3. [](#bugfix)
* Fixed issue with `system.cache.gzip: true` resulted in admin "Fetch Failed" for PHP 8.0+
* Fixed issue with `system.cache.gzip: true` resulted in admin "Fetch Failed" for PHP 8.0.17 and PHP 8.1.4 [PHP bug #8218](https://github.com/php/php-src/issues/8218).
* Fix for multi-lang issues with Security Report
# v1.7.31

View File

@ -43,4 +43,25 @@ class SystemFacade extends \Whoops\Util\SystemFacade
$handler();
}
}
/**
* @param int $httpCode
*
* @return int
*/
public function setHttpResponseCode($httpCode)
{
if (!headers_sent()) {
// Ensure that no 'location' header is present as otherwise this
// will override the HTTP code being set here, and mask the
// expected error page.
header_remove('location');
// Work around PHP bug #8218 (8.0.17 & 8.1.4).
header_remove('Content-Encoding');
}
return http_response_code($httpCode);
}
}

View File

@ -350,14 +350,12 @@ class Grav extends Container
*/
public function cleanOutputBuffers(): void
{
/** @var Config $config */
$config = $this['config'];
$gzip_enabled = (int) $config->get('system.cache.gzip');
// Make sure nothing extra gets written to the response.
while (ob_get_level() > 2 + $gzip_enabled) {
while (ob_get_level()) {
ob_end_clean();
}
// Work around PHP bug #8218 (8.0.17 & 8.1.4).
header_remove('Content-Encoding');
}
/**