Skip to content

[PropertyInfo] Prevent returning int values in some cases #22426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getProperties($class, array $context = array())

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

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

return array_keys($properties);
return array_values($properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp()

public function testGetProperties()
{
$this->assertEquals(
$this->assertSame(
array(
'bal',
'parent',
Expand All @@ -49,6 +49,7 @@ public function testGetProperties()
'a',
'DOB',
'Id',
'123',
'c',
'd',
'e',
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,8 @@ public function getDOB()
public function getId()
{
}

public function get123()
{
}
}