You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (null === $obj && $this->nodes['attribute']->isNullSafe) {
74
+
returnnull;
75
+
}
72
76
if (!\is_object($obj)) {
73
77
thrownew \RuntimeException(sprintf('Unable to get property "%s" of non-object "%s".', $this->nodes['attribute']->dump(), $this->nodes['node']->dump()));
74
78
}
@@ -79,6 +83,9 @@ public function evaluate(array $functions, array $values)
Copy file name to clipboardExpand all lines: src/Symfony/Component/ExpressionLanguage/Parser.php
+56-41
Original file line number
Diff line number
Diff line change
@@ -335,49 +335,18 @@ public function parsePostfixExpression(Node\Node $node)
335
335
{
336
336
$token = $this->stream->current;
337
337
while (Token::PUNCTUATION_TYPE == $token->type) {
338
-
if ('.' === $token->value) {
338
+
if ('?' === $token->value) {
339
339
$this->stream->next();
340
340
$token = $this->stream->current;
341
-
$this->stream->next();
342
-
343
-
if (
344
-
Token::NAME_TYPE !== $token->type
345
-
&&
346
-
// Operators like "not" and "matches" are valid method or property names,
347
-
//
348
-
// In other words, besides NAME_TYPE, OPERATOR_TYPE could also be parsed as a property or method.
349
-
// This is because operators are processed by the lexer prior to names. So "not" in "foo.not()" or "matches" in "foo.matches" will be recognized as an operator first.
350
-
// But in fact, "not" and "matches" in such expressions shall be parsed as method or property names.
351
-
//
352
-
// And this ONLY works if the operator consists of valid characters for a property or method name.
353
-
//
354
-
// Other types, such as STRING_TYPE and NUMBER_TYPE, can't be parsed as property nor method names.
355
-
//
356
-
// As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown.
// Operators like "not" and "matches" are valid method or property names,
386
+
//
387
+
// In other words, besides NAME_TYPE, OPERATOR_TYPE could also be parsed as a property or method.
388
+
// This is because operators are processed by the lexer prior to names. So "not" in "foo.not()" or "matches" in "foo.matches" will be recognized as an operator first.
389
+
// But in fact, "not" and "matches" in such expressions shall be parsed as method or property names.
390
+
//
391
+
// And this ONLY works if the operator consists of valid characters for a property or method name.
392
+
//
393
+
// Other types, such as STRING_TYPE and NUMBER_TYPE, can't be parsed as property nor method names.
394
+
//
395
+
// As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown.
0 commit comments