Open
Description
Description
The following code:
<?php
'missing'(...);
Resulted in this output:
Fatal error: Uncaught Error: Call to undefined function missing()
But I expected this output instead:
Fatal error: Uncaught Error: Unable to create closure from undefined function missing()
When using the first-class callable syntax on a missing function, the error message claims the user is calling a function. However, this should only be creating a closure.
I thought the (...)
syntax would only try to create a closure. Does it actually try to call the function with a ...
argument if it's not found?
If you use the original Closure::fromCallable()
method, the error is different.
Closure::fromCallable('missing');
Uncaught TypeError: Failed to create closure from callable: function "missing" not found or invalid function name
PHP Version
8.1
Operating System
No response