Join::join() raises TypeError instead of InvalidArgumentException for an invalid name without a leading string
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 18
- Fork
- 8
- Merge trung bình
- 6 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của php-db/phpdb
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
PrestaShop/PrestaShop#43140 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
McNamara84/ernie#1437 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 3 ngày
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày