Skip to content

Commit f82b76f

Browse files
committed
Default to null values for missing object keys
1 parent a2728c3 commit f82b76f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Core/Interpreter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ private function evaluateMemberExpression(MemberExpression $expr, Environment $e
758758
throw new RuntimeException("Cannot access property with non-string: got {$property->type}");
759759
}
760760

761-
$value = $object->value[$property->value] ?? $object->builtins[$property->value];
761+
$value = $object->value[$property->value] ?? $object->builtins[$property->value] ?? new NullValue();
762762
} else if ($object instanceof ArrayValue || $object instanceof StringValue) {
763763
if ($property instanceof IntegerValue) {
764764
$index = $property->value;

0 commit comments

Comments
 (0)