Bug #69991 [Ver]: Fatal error

From: Date: Thu, 09 Jul 2015 06:22:07 +0000
Subject: Bug #69991 [Ver]: Fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194237@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69991&edit=1 ID: 69991 Updated by: trowski@php.net Reported by: dievartg at gmail dot com Summary: Fatal error Status: Verified Type: Bug Package: Reflection related Operating System: linux PHP Version: 7.0.0alpha2 Block user comment: N Private report: N New Comment: This will be addressed eventually by the PR I added, but it likely will not be merged until 7.1. Previous Comments: ------------------------------------------------------------------------ [2015-07-04 13:15:18] cmb@php.net No, this is not supposed to work (neither with 5 nor 7). However, as Damian already pointed out, ::getReturnType() raises a fatal error instead of an exception (<http://3v4l.org/f20S1>), what seems to be undesired behavior for PHP 7. ------------------------------------------------------------------------ [2015-07-04 10:26:24] kalle@php.net So did this used to work on 5.x series, or? ------------------------------------------------------------------------ [2015-07-04 05:50:24] dievartg at gmail dot com ReflectionFunctionAbstract is extended to test a mock generator, for a unit testing framework. ------------------------------------------------------------------------ [2015-07-04 00:52:58] requinix@php.net Yes, it is raising an error rather than throwing an exception. http://3v4l.org/f20S1#v700alpha2 Note that it doesn't make sense to extend ReflectionFunctionAbstract because you can't provide the "reflection object" which the error is talking about. ------------------------------------------------------------------------ [2015-07-03 19:46:50] dievartg at gmail dot com Description: ------------ Hello, a fatal error (no catchable) is thrown when I attempt to call the mehod getReturnType from a class inheriting of ReflectionFunctionAbstract Do you think it's a normal behavior ? Test script: --------------- <?php class MockReflectionMethod extends ReflectionFunctionAbstract { public static function export() {} public function __toString() {} } try { (new MockReflectionMethod)->isStatic(); } catch(Throwable $e) { echo $e->getMessage(); } try { (new MockReflectionMethod)->getReturnType(); } catch(Throwable $e) { echo $e->getMessage(); } // output: // Call to undefined method MockReflectionMethod::isStatic() // Fatal error: ReflectionFunctionAbstract::getReturnType(): Internal error: Failed to retrieve the reflection object Actual result: -------------- http://3v4l.org/7LjRK ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69991&edit=1

« previous php.bugs (#194237) next »