Skip to content

Commit b190ec2

Browse files
committed
[PropertyInfo] Prevent returning int values in some cases.
1 parent d564c6a commit b190ec2

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getProperties($class, array $context = array())
6464

6565
$properties = array();
6666
foreach ($reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflectionProperty) {
67-
$properties[$reflectionProperty->name] = true;
67+
$properties[$reflectionProperty->name] = $reflectionProperty->name;
6868
}
6969

7070
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
@@ -79,10 +79,10 @@ public function getProperties($class, array $context = array())
7979
if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) {
8080
$propertyName = lcfirst($propertyName);
8181
}
82-
$properties[$propertyName] = true;
82+
$properties[$propertyName] = $propertyName;
8383
}
8484

85-
return array_keys($properties);
85+
return array_values($properties);
8686
}
8787

8888
/**

src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp()
3232

3333
public function testGetProperties()
3434
{
35-
$this->assertEquals(
35+
$this->assertSame(
3636
array(
3737
'bal',
3838
'parent',
@@ -49,6 +49,7 @@ public function testGetProperties()
4949
'a',
5050
'DOB',
5151
'Id',
52+
'123',
5253
'c',
5354
'd',
5455
'e',

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,8 @@ public function getDOB()
116116
public function getId()
117117
{
118118
}
119+
120+
public function get123()
121+
{
122+
}
119123
}

0 commit comments

Comments
 (0)