fix: Do not try to create lazy ghosts for PHP internal classes

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
(cherry picked from commit d51efd9735)
This commit is contained in:
Côme Chilliet 2025-09-28 14:35:49 +02:00
parent 7ccdda651c
commit 2f3e2c0928
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

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 {