Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#210 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@simon-mundy ci sta già lavorando.

Dal 5/10/2026.

  • #226 di @simon-mundy — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
PHP
Stelle
18
Fork
8
Merge medio
6g 11h
PR unite (30g)
14

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di php-db/phpdb

Tutte le issue di php-db/phpdb

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.