From: php dot net at vdachev dot net
Operating system: Ubuntu Quantal
PHP version: 5.4.7
Package: Reflection related
Bug Type: Feature/Change Request
Bug description:ReflectionMethod::invoke() on non-abstract ancestor
Description:
------------
Consider a situation when an abstract class (or an interface) is defined
and a
concrete class that extends it. If we get instantiate a ReferenceClass
object for
the abstract class (or the interface), we can then get an ReferenceMethod
instance
for the abstract method.
Unfortunately, calling the ReferenceMethod::invoke() method for an instance
of the
concrete class throws a ReflectionException ("Trying to invoke abstract
method...").
Test script:
---------------
<?php
abstract class A
{
public abstract function doA();
}
interface IB
{
function doB();
}
class B extends A implements IB
{
public function doA()
{
echo 'A is done.';
}
public function doB()
{
echo 'B is done.';
}
}
$b = new B();
$b->doA();
$b->doB();
$refA = new \ReflectionClass('A');
$refDoA = $refA->getMethod('doA');
$refDoA->invoke($b);
$refIB = new \ReflectionClass('IB');
$refDoB = $refIB->getMethod('doB');
$refDoB->invoke($b);
?>
Expected result:
----------------
The invocation of the method on an instance of the concrete class should
succeed.
Actual result:
--------------
PHP Fatal error: Uncaught exception 'ReflectionException' with message
'Trying to
invoke abstract method ...()' in ...:..
--
Edit bug report at https://bugs.php.net/bug.php?id=63196&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63196&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63196&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63196&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63196&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63196&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63196&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63196&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63196&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63196&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63196&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63196&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63196&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63196&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63196&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63196&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63196&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63196&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63196&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63196&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63196&r=mysqlcfg