8000 Merge branch '6.3' into 6.4 · camillebaronnet/symfony@80f1096 · GitHub
[go: up one dir, main page]

Skip to content

Commit 80f1096

Browse files
Merge branch '6.3' into 6.4
* 6.3: [PropertyAccess] Fix access to undefined "file" key when checking stack frames
2 parents 5b5db32 + e15ccda commit 80f1096

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private function readProperty(array $zval, string $property, bool $ignoreInvalid
413413
[$trace] = $e->getTrace();
414414

415415
// handle uninitialized properties in PHP >= 7
416-
if (__FILE__ === $trace['file']
416+
if (__FILE__ === ($trace['file'] ?? null)
417417
&& $name === $trace['function']
418418
&& $object instanceof $trace['class']
419419
&& preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches)
@@ -545,7 +545,7 @@ private function writeProperty(array $zval, string $property, mixed $value, bool
545545
throw new NoSuchPropertyException(sprintf('Could not determine access type for property "%s" in class "%s".', $property, get_debug_type($object)));
546546
}
547547
} catch (\TypeError $e) {
548-
if ($recursive || !$value instanceof \DateTimeInterface || !\in_array($value::class, ['DateTime', 'DateTimeImmutable'], true) || __FILE__ !== $e->getTrace()[0]['file']) {
548+
if ($recursive || !$value instanceof \DateTimeInterface || !\in_array($value::class, ['DateTime', 'DateTimeImmutable'], true) || __FILE__ !== ($e->getTrace()[0]['file'] ?? null)) {
549549
throw $e;
550550
}
551551

0 commit comments

Comments
 (0)
0