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

Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased array

Đang mở
#210 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.

  • #226 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
50/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
databases

Hướng nghiên cứu

The TypeError originates in src/Sql/Exception/InvalidArgumentException::forForeignTable() at line 114, which expects a string but receives $this->table from src/Sql/Sql.php. Examine the four call sites in Sql.php (delete, insert, select, update) and the TableIdentifier class to understand how to convert table representations to strings. The fix should produce messages like 'app.users' for TableIdentifier and 'users AS u' for aliased arrays. Run the test suite, particularly any Sql or InvalidArgumentException tests, to verify the exception message format.

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

Sql::delete(), insert(), select() and update() throw when asked for a table other than the one Sql was constructed with (Sql.php#L46, #L75, #L102, #L121). Each passes $this->table to forForeignTable(string $table) (InvalidArgumentException.php#L114). Sql's table can be a TableIdentifier or an aliased array, and either raises a TypeError while building the exception.

#192 notes this as needing its own issue: "TableIdentifier has no __toString(), so Sql::forForeignTable($this->table) fatals when $this->table is a TableIdentifier".

Steps to Reproduce
  1. new Sql($adapter, new TableIdentifier('users', 'app')), then ->select('other').
  2. new Sql($adapter, ['u' => 'users']), then ->select('other').
Expected Behavior

PhpDb\Sql\Exception\InvalidArgumentException with a message naming the table: app.users for a TableIdentifier, and users AS u for an aliased array.

Actual behavior?
TypeError: PhpDb\Sql\Exception\InvalidArgumentException::forForeignTable(): Argument #1 ($table) must be of type string, PhpDb\Sql\TableIdentifier given
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.