Edit report at https://bugs.php.net/bug.php?id=61467&edit=1
ID: 61467
User updated by: david at grudl dot com
Reported by: david at grudl dot com
-Summary: New "callable" typehint do not work (autoloading)
+Summary: New "callable" typehint does not work (autoloading)
Status: Open
Type: Bug
Package: Class/Object related
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
do -> does
Previous Comments:
------------------------------------------------------------------------
[2012-03-21 20:22:00] david at grudl dot com
Description:
------------
Is really new type hint callable implemented? I see no difference between PHP 5.3 and PHP 5.4, both
versions only throw catchable fatal errors.
(I think this unexpected behaviour is due to the fact that class "A" do not exists. In
this case the error message is confusing. But the callable should not trigger autoload, it should
behave like is_callable($arg, TRUE) and just check the syntax. Otherwise typehint callable will
cause major performance issues.)
Test script:
---------------
function test(callable $a)
{
}
test(array('A', 'b'));
// Catchable fatal error: Argument 1 passed to test() must be an instance of callable, array given
test('A::b');
// Catchable fatal error: Argument 1 passed to test() must be an instance of callable, string given
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61467&edit=1