Skip to content

Commit ac07f3e

Browse files
committed
bug symfony#54081 [DoctrineBridge] Safeguard dynamic access to Doctrine metadata properties (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- [DoctrineBridge] Safeguard dynamic access to Doctrine metadata properties | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#54077 | License | MIT Commits ------- 9eadc22 Safeguard dynamic access to Doctrine metadata properties
2 parents dc1da9c + 9eadc22 commit ac07f3e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static function getRealClass(string $class): string
208208
private static function getMappingValue($mapping, string $key)
209209
{
210210
if ($mapping instanceof JoinColumnMapping) {
211-
return $mapping->$key;
211+
return $mapping->$key ?? null;
212212
}
213213

214214
return $mapping[$key] ?? null;

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ private function getPhpType(string $doctrineType): ?string
314314
private static function getMappingValue($mapping, string $key)
315315
{
316316
if ($mapping instanceof AssociationMapping || $mapping instanceof EmbeddedClassMapping || $mapping instanceof FieldMapping || $mapping instanceof JoinColumnMapping) {
317-
return $mapping->$key;
317+
return $mapping->$key ?? null;
318318
}
319319

320320
return $mapping[$key] ?? null;

src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function getExistingUniqueFields(ClassMetadata $metadata): array
148148
private static function getFieldMappingValue($mapping, string $key)
149149
{
150150
if ($mapping instanceof FieldMapping) {
151-
return $mapping->$key;
151+
return $mapping->$key ?? null;
152152
}
153153

154154
return $mapping[$key] ?? null;

0 commit comments

Comments
 (0)