|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-06-11 19:08 UTC] nikic@php.net
Description:
------------
<?php
$f = function(stdClass $x) {};
$r = new ReflectionMethod($f, '__invoke');
var_dump($r->getParameters()[0]->getClass());
results in:
Fatal error: Uncaught ReflectionException: Class does not exist ...
because the via-handler function is INTERNAL, while the arginfo uses USER layout. Basically the comment in http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_closures.c#210 is not true where Reflection is concerned.
Maybe we need another flag to specify the arginfo layout independently from the type of the function?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 16:00:01 2025 UTC |
This does not fully fix the issue as the handler function can also be internal. For example: <?php $f = (new ReflectionFunction('iterator_to_array'))->getClosure(); $r = new ReflectionMethod($f, '__invoke'); var_dump($r->getParameters()[0]->getClass()); now results in Fatal error: Allowed memory size of 134217728 bytes exhausted at /home/nikic/php-src/Zend/zend_string.h:98 (tried to allocate 7959380068570588552 bytes) in /home/nikic/php-src/t096.php on line 4