|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44003 odbc_fetch_array returns truncated field names
Submitted: 2008-01-31 18:17 UTC Modified: 2020-10-05 13:25 UTC
Avg. Score:4.7 ± 0.6
Reproduced:14 of 14 (100.0%)
Same Version:3 (21.4%)
Same OS:6 (42.9%)
From: tceverling at yahoo dot co dot uk Assigned: cmb (profile)
Status: Duplicate Package: ODBC related
PHP Version: 5.2.5 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tceverling at yahoo dot co dot uk
New email:
PHP Version: OS:


 [2008-01-31 18:17 UTC] tceverling at yahoo dot co dot uk
After executing a "SELECT" SQL query and then doing an odbc_fetch_array(), field names longer than 31 characters gets truncated.

Reproduce code:

$link = odbc_connect('MYSQL', '', '');  //  Connect to MySQL
$res = odbc_exec($link, 'select * from test');

$link = odbc_connect('Access', '', '');  //  Connect to Microsoft Access
$res = odbc_exec($link, 'select * from test');


Expected result:
Assuming that a field name within the table `test` is '1234567890123456789012345678901234567890', expected result maybe like:

array(1) {
  string(1) "1"

array(1) {
  string(1) "1"

Actual result:
array(1) {
  string(1) "1"

array(1) {
  string(1) "1"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-17 13:09 UTC] netvbonline at yahoo dot co dot uk
This is over a year old? Has anyone been able to fix as I am using latest version of PHP as of 17 Apr 2009 with dynamic queries and just encountered this issue

Many Thanks :-))
 [2009-08-11 16:29 UTC] tyler dot reese at taqua dot com
In /ext/odbc/php_odbc_includes.h, you can change the 'name' field, of the 'odbc_result_value' struct, from 32 to 256 (or whatever length you need), and then recompile PHP.

With that said, is this (changing 'name' length from 32 to 256) ever going to be a permanent fix in any upcoming official version of PHP?

This same issue is reported in:
Bug #30043 ODBC Column Name Truncation (missing multi-byte support)
 [2020-10-05 13:25 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2020-10-05 13:25 UTC]
This issue has been fixed as bug #65950.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 00:05:53 2022 UTC