php / php/php-src

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

Đang mở
#15,219 17 bình luận 0 reaction 1 người được giao Xem trên GitHub

@cmb69 đang làm issue này rồi.

Từ ngày 5/8/2024.

Bug Extension: odbc Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.