[php-src] Issue #8623: Awkward error using first-class callable syntax with missing function

From: Date: Tue, 24 May 2022 13:41:32 +0000
Subject: [php-src] Issue #8623: Awkward error using first-class callable syntax with missing function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241585@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8623 Author: othercorey ### Description The following code: ```php <?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. ```php 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_

« previous php.bugs (#241585) next »