Fix API for php8
This commit is contained in:
parent
12645926cc
commit
fa1bddc79d
@ -346,17 +346,19 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||||||
// If API_DISABLE_COMPRESSION is set, returnResponse is false => It use default handling so output result directly.
|
// If API_DISABLE_COMPRESSION is set, returnResponse is false => It use default handling so output result directly.
|
||||||
$usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
$usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||||
$foundonealgorithm = 0;
|
$foundonealgorithm = 0;
|
||||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
if ($usecompression) {
|
||||||
|
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
||||||
$foundonealgorithm++;
|
$foundonealgorithm++;
|
||||||
}
|
}
|
||||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
||||||
$foundonealgorithm++;
|
$foundonealgorithm++;
|
||||||
}
|
}
|
||||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||||
$foundonealgorithm++;
|
$foundonealgorithm++;
|
||||||
}
|
}
|
||||||
if (!$foundonealgorithm) {
|
if (!$foundonealgorithm) {
|
||||||
$usecompression = false;
|
$usecompression = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//dol_syslog('We found some compression algoithm: '.$foundonealgorithm.' -> usecompression='.$usecompression, LOG_DEBUG);
|
//dol_syslog('We found some compression algoithm: '.$foundonealgorithm.' -> usecompression='.$usecompression, LOG_DEBUG);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user