8000 Fixing bug where PropertyInfoLoader tried to add validation to non-ex… · symfony/symfony@89f72a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89f72a1

Browse files
committed
Fixing bug where PropertyInfoLoader tried to add validation to non-existent properties
1 parent 4f714a6 commit 89f72a1

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public function loadClassMetadata(ClassMetadata $metadata)
6060
continue;
6161
}
6262

63+
if (false === property_exists($className, $property)) {
64+
continue;
65+
}
66+
6367
$types = $this->typeExtractor->getTypes($className, $property);
6468
if (null === $types) {
6569
continue;

src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ class PropertyInfoLoaderEntity
4848
public $alreadyPartiallyMappedCollection;
4949

5050
public $readOnly;
51+
52+
public function setNonExistentField()
53+
{
54+
}
5155
}

src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testLoadClassMetadata()
4646
'alreadyMappedNotBlank',
4747
'alreadyPartiallyMappedCollection',
4848
'readOnly',
49+
'nonExistentField',
4950
])
5051
;
5152
$propertyInfoStub

0 commit comments

Comments
 (0)
0