php / php/php-src

odbc_fetch_*() fails to fetch SQL Server text fields with SQL_CUR_USE_ODBC

Aperta
#15,219 17 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@cmb69 ci sta già lavorando.

Dal 5/8/2024.

Bug Extension: odbc Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

The following code:

$conn = odbc_connect('DRIVER={SQL Server Native Client 11.0};SERVER=LOCALHOST\SQLSERVER;DATABASE=OIDPLUS;charset=UTF-8;Client_CSet=UTF-8;Server_CSet=UTF-8', 'sa', '123456', SQL_CUR_USE_ODBC);
$res = odbc_exec($conn, "select description from my_objects");
while ($row = odbc_fetch_object($res)) {
	var_dump($row);
}
echo odbc_close($conn);

Resulted in this output:

(Nothing; odbc_fetch_object is false)

But I expected this output instead:

Printed array with descriptions

The bug only happens if odbc_connect() has SQL_CUR_USE_ODBC and it ONLY fails if you fetch exactly one column with the text data type. If you fetch a text row and another row, then it works!

  • select description from my_objects does NOT work
  • select id, description from my_objects WORKS
  • select id from my_objects WORKS

System:

  • Windows 10 Pro
  • SQL Server 2022
PHP Version

PHP 8.3.6 (also tested with PHP 8.4 Alpha 4)

Operating System

Windows 10 x64

Guida per i contributori

Apri la 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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.