diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 162ee929ddb..488dc2be90a 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -3478,6 +3478,11 @@ + + + getTypedValue($userId, $app, $key, $default ? 'true' : 'false', $lazy, ValueType::BOOL)]]> + + request->server]]> diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 55c23f0c0e1..093d983deab 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -682,7 +682,11 @@ class UserConfig implements IUserConfig { bool $default = false, bool $lazy = false, ): bool { - $b = strtolower($this->getTypedValue($userId, $app, $key, $default ? 'true' : 'false', $lazy, ValueType::BOOL)); + // The explicit (string) cast guards against a PHP OPcache bug where values passed + // by reference across function boundaries can have their type corrupted (e.g. bool + // returned as int). Affects PHP 8.x with OPcache enabled; fixed upstream in + // https://github.com/php/php-src/pull/21973. Keep until minimum PHP version is bumped. + $b = strtolower((string)$this->getTypedValue($userId, $app, $key, $default ? 'true' : 'false', $lazy, ValueType::BOOL)); return in_array($b, ['1', 'true', 'yes', 'on']); }