Skip to content

Commit a2f4367

Browse files
committed
[DDC-2708][DCOM-219] Fix PHP 5.4.8 not returning true is_callable on abstract methods anymore.
1 parent c94d6ff commit a2f4367

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
use ReflectionClass;
2323
use ReflectionProperty;
24+
use ReflectionMethod;
25+
use ReflectionException;
26+
2427
use Doctrine\Common\Reflection\RuntimePublicReflectionProperty;
2528
use Doctrine\Common\Persistence\Mapping\MappingException;
2629

@@ -92,6 +95,12 @@ public function getAccessibleProperty($class, $property)
9295
*/
9396
public function hasPublicMethod($class, $method)
9497
{
95-
return method_exists($class, $method) && is_callable(array($class, $method));
98+
try {
99+
$reflectionMethod = new ReflectionMethod($class, $method);
100+
} catch (ReflectionException $e) {
101+
return false;
102+
}
103+
104+
return $reflectionMethod->isPublic();
96105
}
97106
}

lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ public function getAccessibleProperty($class, $property)
7878
*/
7979
public function hasPublicMethod($class, $method)
8080
{
81-
return method_exists($class, $method) && is_callable(array($class, $method));
81+
return true;
8282
}
8383
}

tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testGetReflectionClass()
5858
public function testGetMethods()
5959
{
6060
$this->assertTrue($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods"));
61-
$this->assertFalse($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods2"));
61+
$this->assertTrue($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods2"));
6262
}
6363

6464
public function testGetAccessibleProperty()

0 commit comments

Comments
 (0)