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

Result::setFetchMode() cannot drive FETCH_CLASS or FETCH_INTO

Aperta
#198 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@simon-mundy ci sta già lavorando.

Dal 29/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug confirmed

Pdo\Result::setFetchMode(int $fetchMode) accepts only an int. PDOStatement::fetch() needs a class name for FETCH_CLASS and a target object for FETCH_INTO, and there is no way to supply either.

Both are listed in Result::VALID_FETCH_MODES, so setFetchMode() accepts them and the failure surfaces later, on the first fetch:

FETCH_CLASS  PDOException: SQLSTATE[HY000]: General error: No fetch class specified
FETCH_INTO   PDOException: SQLSTATE[HY000]: General error: No fetch-into object specified.

Reproduced against SQLite in memory; covered by ResultSetFetchModeTest::fetchModesNeedingExtraArgumentsCannotBeDriven, which currently asserts only that they throw.

Fix is either to widen setFetchMode() to take the extra arguments PDO requires, or to reject both modes up front instead of at fetch time.

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.