Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#210 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@simon-mundy がすでに取り組んでいます。

2026年10月5日 から。

  • #226 @simon-mundy による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
databases

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
PHP
スター
18
フォーク
8
平均マージ
6日 11時間
マージ済み PR(30日)
14

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

php-db/phpdb のほかの issue

php-db/phpdb の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。