diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index a1ff632231dd2..56d14a36f366b 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -435,6 +435,14 @@ private function readIndex($zval, $index) } elseif (is_object($result[self::VALUE])) { $result[self::REF] = $result[self::VALUE]; } + } else { + $message = sprintf('Undefined index %s.', $index); + + if ($keys = array_keys($zval[self::VALUE])) { + $message .= sprintf('Available indexes are "%s".', print_r($keys, true)); + } + + throw new NoSuchIndexException($message); } return $result;