Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#210 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@simon-mundy ya está trabajando en esto.

Desde el 5/10/2026.

  • #226 de @simon-mundy — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
50/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
databases

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
PHP
Estrellas
18
Forks
8
Merge medio
6 d 11 h
PR fusionados (30 d)
14

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de php-db/phpdb

Todos los issues de php-db/phpdb

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.