From:
Operating system: win
PHP version: 5.3.8
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionFunction Internal Error provocation
Description:
------------
Normally Instantiation fails (ReflectionException):
$test = new ReflectionFunction('');
However this can be fooled:
$obj = new stdClass();
$test = new ReflectionFunction($obj);
echo $test;
The echo line triggers a fatal error then:
Fatal error: ReflectionFunction::__toString(): Internal error: Failed to
retrieve the reflection object
Before that happens there is a slightly misworded warning ahead:
Warning: ReflectionFunction::__construct() expects parameter 1 to be
string,
object given
Misworded in the sense that it's possible objects with __toString() and
closures.
Probably something in the logic inside the constructor is not right. It
would be
good if in such cases an ReflectionException is thrown on instantiation.
Test script:
---------------
$obj = new stdClass();
$test = new ReflectionFunction($obj);
echo $test;
Expected result:
----------------
ReflectionException
Actual result:
--------------
Fatal Error
--
Edit bug report at https://bugs.php.net/bug.php?id=60620&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60620&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60620&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60620&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60620&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60620&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60620&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60620&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60620&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60620&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60620&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60620&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60620&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60620&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60620&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60620&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60620&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60620&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60620&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60620&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60620&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60620&r=mysqlcfg