diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index df1c16754d078..531fd4bd1f97f 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -508,7 +508,7 @@ private function readProperty($zval, $property) */ private function getReadAccessInfo($class, $property) { - $key = (false !== strpos($class, '@') ? rawurlencode($class) : $class).'..'.$property; + $key = false !== strpbrk($key = $class.'..'.$property, '{}()/\@:') ? rawurlencode($key) : $key; if (isset($this->readPropertyCache[$key])) { return $this->readPropertyCache[$key]; @@ -687,7 +687,7 @@ private function writeCollection($zval, $property, $collection, $addMethod, $rem */ private function getWriteAccessInfo($class, $property, $value) { - $key = (false !== strpos($class, '@') ? rawurlencode($class) : $class).'..'.$property; + $key = false !== strpbrk($key = $class.'..'.$property, '{}()/\@:') ? rawurlencode($key) : $key; if (isset($this->writePropertyCache[$key])) { return $this->writePropertyCache[$key]; @@ -868,7 +868,8 @@ private function getPropertyPath($propertyPath) } if ($this->cacheItemPool) { - $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_PROPERTY_PATH.$propertyPath); + $key = false !== strpbrk($propertyPath, '{}()/\@:') ? rawurlencode($propertyPath) : $propertyPath; + $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_PROPERTY_PATH.$key); if ($item->isHit()) { return $this->propertyPathCache[$propertyPath] = $item->get(); }