diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
index cce387ccfe..507791c37f 100644
--- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
@@ -190,12 +190,17 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
'args' => [$class],
];
- if (false === $i = array_search($autoloadFrame, $trace, true)) {
+ if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
+ $callerFrame = $trace[1];
+ $i = 2;
+ } elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
+ $callerFrame = $trace[++$i];
+ } else {
throw $e;
}
- if (isset($trace[++$i]['function']) && !isset($trace[$i]['class'])) {
- switch ($trace[$i]['function']) {
+ if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
+ switch ($callerFrame['function']) {
case 'get_class_methods':
case 'get_class_vars':
case 'get_parent_class':
@@ -214,8 +219,8 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
}
$props = [
- 'file' => isset($trace[$i]['file']) ? $trace[$i]['file'] : null,
- 'line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : null,
+ 'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
+ 'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
'trace' => \array_slice($trace, 1 + $i),
];
diff --git a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
index 7a3d8db6a4..c03b1a3239 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
@@ -13,6 +13,8 @@ namespace Symfony\Component\Form\Extension\Core\DataMapper;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
+use Symfony\Component\PropertyAccess\Exception\AccessException;
+use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
@@ -46,7 +48,7 @@ class PropertyPathMapper implements DataMapperInterface
$config = $form->getConfig();
if (!$empty && null !== $propertyPath && $config->getMapped()) {
- $form->setData($this->propertyAccessor->getValue($data, $propertyPath));
+ $form->setData($this->getPropertyValue($data, $propertyPath));
} else {
$form->setData($config->getData());
}
@@ -76,16 +78,32 @@ class PropertyPathMapper implements DataMapperInterface
$propertyValue = $form->getData();
// If the field is of type DateTimeInterface and the data is the same skip the update to
// keep the original object hash
- if ($propertyValue instanceof \DateTimeInterface && $propertyValue == $this->propertyAccessor->getValue($data, $propertyPath)) {
+ if ($propertyValue instanceof \DateTimeInterface && $propertyValue == $this->getPropertyValue($data, $propertyPath)) {
continue;
}
// If the data is identical to the value in $data, we are
// dealing with a reference
- if (!\is_object($data) || !$config->getByReference() || $propertyValue !== $this->propertyAccessor->getValue($data, $propertyPath)) {
+ if (!\is_object($data) || !$config->getByReference() || $propertyValue !== $this->getPropertyValue($data, $propertyPath)) {
$this->propertyAccessor->setValue($data, $propertyPath, $propertyValue);
}
}
}
}
+
+ private function getPropertyValue($data, $propertyPath)
+ {
+ try {
+ return $this->propertyAccessor->getValue($data, $propertyPath);
+ } catch (AccessException $e) {
+ if (!$e instanceof UninitializedPropertyException
+ // For versions without UninitializedPropertyException check the exception message
+ && (class_exists(UninitializedPropertyException::class) || false === strpos($e->getMessage(), 'You should initialize it'))
+ ) {
+ throw $e;
+ }
+
+ return null;
+ }
+ }
}
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.de.xlf b/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
index a9a183197e..fe4353120d 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
@@ -14,6 +14,10 @@
Der CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden.
+
+
+ Dieser Wert ist keine gültige HTML5 Farbe.
+