Awkward error using first-class callable syntax with missing function
未关闭
还没有人认领这个 Issue。
Bug
Category: Engine
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 'missing'(...); 重现 PHP 8.1 示例,并将其错误与 Closure::fromCallable('missing') 的错误进行比较。跟踪对未定义函数的 first-class callable 处理;当该语法报告闭包创建错误,而不是声称函数已被调用时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100