Merge pull request #55375 from nextcloud/fix/do-not-use-lazy-with-internal

fix: Do not try to create lazy ghosts for PHP internal classes
This commit is contained in:
Ferdinand Thiessen 2025-09-28 23:30:42 +02:00 committed by GitHub
commit 61cf047d1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,7 +61,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
/* No constructor, return a instance directly */
return $class->newInstance();
}
if (PHP_VERSION_ID >= 80400 && self::$useLazyObjects) {
if (PHP_VERSION_ID >= 80400 && self::$useLazyObjects && !$class->isInternal()) {
/* For PHP>=8.4, use a lazy ghost to delay constructor and dependency resolving */
/** @psalm-suppress UndefinedMethod */
return $class->newLazyGhost(function (object $object) use ($constructor): void {