diff --git a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php index e9b10c3295d75..c175f7bef70e0 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php @@ -69,6 +69,8 @@ public function evaluate(array $functions, array $values) { switch ($this->attributes['type']) { case self::PROPERTY_CALL: + $this->nodes['node']->attributes['is_null_coalesce'] = $this->attributes['is_null_coalesce'] ?? false; + $obj = $this->nodes['node']->evaluate($functions, $values); if (null === $obj && ($this->nodes['attribute']->isNullSafe || $this->attributes['is_null_coalesce'])) { $this->attributes['is_short_circuited'] = true; @@ -151,7 +153,7 @@ public function toArray() } /** - * Provides BC with instances serialized before v6.2 + * Provides BC with instances serialized before v6.2. */ public function __unserialize(array $data): void { diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index c5dc30cbfb72a..7eb7475fad1d1 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -356,6 +356,7 @@ public function bar() yield ['foo.bar ?? "default"', null]; yield ['foo.bar.baz ?? "default"', (object) ['bar' => null]]; yield ['foo.bar ?? foo.baz ?? "default"', null]; + yield ['foo?.bar?.baz?.qux ?? "default"', (object) ['foo' => null]]; yield ['foo[0] ?? "default"', []]; yield ['foo["bar"] ?? "default"', ['bar' => null]]; yield ['foo["baz"] ?? "default"', ['bar' => null]]; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy