Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Join::join() raises TypeError instead of InvalidArgumentException for an invalid name without a leading string

Đang mở
#206 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@simon-mundy đang làm issue này rồi.

Từ ngày 5/10/2026.

  • #223 của @simon-mundy — đang mở

Đá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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php, sql
Lĩnh vực
databases

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ả

bug
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
  1. (new Join())->join([], 'a = b')
  2. (new Join())->join([new Select('foo')], 'a = b')
  3. (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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của php-db/phpdb

Tất cả issue của php-db/phpdb

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.