|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32830 SQLBindCol on 64bit systems
Submitted: 2005-04-26 10:49 UTC Modified: 2005-05-10 15:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: cvn at interchain dot nl Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.*, 5.* OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 7 = ?
Subscribe to this entry?

 [2005-04-26 10:49 UTC] cvn at interchain dot nl
In the odbc extension SQLBindCol is called with a long int as last parameter (vallen from the odbc_result struct). This should be an SDWORD as is also used with SQLBindParameter (and the ODBC API says).

This is no problem on 32bit compiled versions, only on 64bit compiled PHP versions.

In short: the calls to SQLBindParameter in odbc.c are ok, the calls to SQLBindCol are not.

Only with negative values like SQL_NULL the problem arises, as the value is initialised at (long int) 0, but only 'half' (SDWORD) is written by the driver.

This error is not specific to a PHP version and is there since version 4.

Actual result:
When the SQLBindCol would return a negative value like SQL_NULL only 'half' of the long int vallen is written by the  driver, causing php to think the value is really high, and will dump core when accessing the output value.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-28 00:14 UTC]
Please provide a test case.
Or even a patch, as it seems that you know the extact problem and it's solution (diff -u would be fine).
 [2005-04-28 01:22 UTC]
I would guess the patch is simply to change 'long int' to 'SDWORD' in ext/odbc/php_odbc_includes.h:233 ? (CVS HEAD branch)

 [2005-05-10 15:22 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon May 17 20:01:24 2021 UTC