Skip to content

Commit 07ce0b6

Browse files
committed
Safeguard dynamic access to Doctrine metadata properties
1 parent 473f59f commit 07ce0b6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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;

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;

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)