Skip to content

Commit d2da4e1

Browse files
committed
fix(UserConfig): add comment explaining the (string) cast and PHP OPcache bug
Reference php/php-src#21973 so the cast is not removed by static analysis or cleanup automation until the minimum PHP version is bumped past the fix.
1 parent e67f0f1 commit d2da4e1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/private/Config/UserConfig.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ public function getValueBool(
705705
bool $default = false,
706706
bool $lazy = false,
707707
): bool {
708+
// The explicit (string) cast guards against a PHP OPcache bug where values passed
709+
// by reference across function boundaries can have their type corrupted (e.g. bool
710+
// returned as int). Affects PHP 8.x with OPcache enabled; fixed upstream in
711+
// https://github.com/php/php-src/pull/21973. Keep until minimum PHP version is bumped.
708712
$b = strtolower((string)$this->getTypedValue($userId, $app, $key, $default ? 'true' : 'false', $lazy, ValueType::BOOL));
709713
return in_array($b, ['1', 'true', 'yes', 'on']);
710714
}

0 commit comments

Comments
 (0)