Join::join() raises TypeError instead of InvalidArgumentException for an invalid name without a leading string
维护者通常 1 天内回复
评估
调研方向
Read the validation in src/Sql/Join.php around the referenced line and the forInvalidJoinName() signature in src/Sql/Exception/InvalidArgumentException.php. Check the reported inputs: the call should raise InvalidArgumentException rather than TypeError, and for a non-string element the message should name its type. A linked pull request is already open, so check its status before starting.
由索引模型根据 Issue 内容生成。
描述
Package Version
0.6.x-dev @ e022af5c
Php Version
8.3, 8.4, 8.5
Database Engine
Any
Basic Information
Join::join() rejects a name array that is not a single-element associative array, and passes the array's first element into the message (Join.php#L97):
throw Exception\InvalidArgumentException::forInvalidJoinName(array_shift($name));
forInvalidJoinName() takes a string (InvalidArgumentException.php#L134). When the first element is not a string (an empty array, an unaliased Select, an integer), building the exception raises a TypeError first.
This came in with #192, which replaced sprintf(...) (which accepted any type) with the typed named constructor. #192 notes that the same unsoundness was re-attributed to forInvalidJoinName in the analyzer baseline.
Steps to Reproduce
(new Join())->join([], 'a = b')(new Join())->join([new Select('foo')], 'a = b')(new Join())->join([5], 'a = b')
Expected Behavior
PhpDb\Sql\Exception\InvalidArgumentException. Where the element is not a string, the message names its type, e.g. join() expects 'int' as a single element associative array.
Actual behavior?
TypeError: PhpDb\Sql\Exception\InvalidArgumentException::forInvalidJoinName(): Argument #1 ($name) must be of type string, null given, called in src/Sql/Join.php on line 115
- 主要语言
- PHP
- 星标
- 18
- 派生
- 8
- 平均合并
- 6 天 11 小时
- 30 天内合并 PR
- 14
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php-db/phpdb 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
RFC
难度 3/5 1-2 天 新手友好度 66/100
维护者通常 1 天内回复
-
RFC
难度 5/5 一周以上 新手友好度 38/100
维护者通常 1 天内回复
-
RFC
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 1 天内回复
-
RFC
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
Bug Enhancement Performance
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Feature Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
frontend low-priority
难度 2/5 1-3 小时 新手友好度 77/100
mplodowski/dynamicpdf-plugin#336 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
AdvancedCustomFields/acf#1044 ·
-
Add Zammad可能已有人在做 @Arslan-TR 今天认领。 未关闭request
难度 2/5 1-3 小时 新手友好度 66/100
endoflife-date/endoflife.date#11298 · 1 条评论 ·
维护者通常 1 天内回复