php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50444 PDO-ODBC changes for 64-bit
Submitted: 2009-12-11 00:25 UTC Modified: 2014-01-01 12:49 UTC
Votes:28
Avg. Score:5.0 ± 0.0
Reproduced:28 of 28 (100.0%)
Same Version:10 (35.7%)
Same OS:6 (21.4%)
From: davbrown4 at yahoo dot com Assigned:
Status: Closed Package: PDO ODBC
PHP Version: 5.3.1 OS: Solaris
Private report: No CVE-ID: None
 [2009-12-11 00:25 UTC] davbrown4 at yahoo dot com
Description:
------------
While testing the 64-bit version of our ODBC driver (StarQuest StarSQL http://www.starquest.com) on Solaris SPARC, with unixODBC 2.2.14 (the current stable version), we encountered typedef problems with the PDO-ODBC support - it needed 64-bit changes similar to what had already been done to the ODBC support.  The lines that needed to be changed were pointed out by the Solaris (Sun Workshop) compiler.

(Note that in unixODBC 2.2.14, the default build for 64 bit platforms is to make sizeof( SQLLEN ) = 8. The changes below should continue to work with the older interpretation (BUILD_LEGACY_64_BIT_MODE)).


Reproduce code:
---------------
The following are our diffs to 5.3.1 (we originally were working with 5.2.11).

diff -ur pdo_odbc-orig pdo_odbc
diff -ur pdo_odbc-orig/odbc_stmt.c pdo_odbc/odbc_stmt.c
--- pdo_odbc-orig/odbc_stmt.c   2009-07-14 19:32:43.000000000 -0700
+++ pdo_odbc/odbc_stmt.c        2009-12-03 16:36:42.000000000 -0800
@@ -279,7 +279,7 @@
        pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
        RETCODE rc;
        SWORD sqltype = 0, ctype = 0, scale = 0, nullable = 0;
-       UDWORD precision = 0;
+       SQLULEN precision = 0;
        pdo_odbc_param *P;

        /* we're only interested in parameters for prepared SQL right now */
@@ -546,7 +546,7 @@
        zend_bool dyn = FALSE;
        RETCODE rc;
        SWORD   colnamelen;
-       SDWORD  colsize, displaysize;
+       SQLULEN colsize, displaysize;

        rc = SQLDescribeCol(S->stmt, colno+1, S->cols[colno].colname,
                        sizeof(S->cols[colno].colname)-1, &colnamelen,
diff -ur pdo_odbc-orig/php_pdo_odbc_int.h pdo_odbc/php_pdo_odbc_int.h
--- pdo_odbc-orig/php_pdo_odbc_int.h    2008-12-31 03:15:49.000000000 -0800
+++ pdo_odbc/php_pdo_odbc_int.h 2009-12-03 16:37:45.000000000 -0800
@@ -157,7 +157,7 @@
 } pdo_odbc_stmt;

 typedef struct {
-       SQLINTEGER len;
+       SQLLEN len;
        SQLSMALLINT paramtype;
        char *outbuf;
        unsigned is_unicode:1;






Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-12 16:59 UTC] davbrown4 at yahoo dot com
Hello - are there any plans to accept this fix? We have customers using php who need this fix.
 [2014-01-01 12:49 UTC] felipe@php.net
-Package: PDO related +Package: PDO ODBC
 [2014-01-31 19:13 UTC] samifruit514 at hotmail dot com
We also need this for our sql server native 11 connection
 [2014-03-19 23:21 UTC] kadler at us dot ibm dot com
We have customers running in to this problem on x86_64 and PPC64 Linux using our new IBM i Access ODBC driver, since we now build against the newer version of unixODBC that has a 64-bit SQLLEN.

I've added a pull request against the latest code in GitHub. Hopefully, this should make it easy enough to close this nearly 4.5 year old bug.
 [2014-03-28 16:03 UTC] fdemoures at sotraig dot fr
I use pdo_odbc on Ubuntu 13.10 x86_64 with php 5.5.3 and the new driver odbc IBM i Access.
Segmentation fault occurs on execute() after a prepare().
If I use query() directly, it works.
On architecture i386 it works.
 [2014-04-20 23:50 UTC] stas@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=186ffcb72c982b0235761bdd6388ff1c36d79568
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-04-20 23:50 UTC] stas@php.net
-Status: Open +Status: Closed
 [2014-04-20 23:50 UTC] stas@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85c06f17f3f36d877b1c9ffbe8d68a998b3de4dc
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-04-25 23:25 UTC] ab@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=186ffcb72c982b0235761bdd6388ff1c36d79568
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-04-25 23:29 UTC] ab@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=186ffcb72c982b0235761bdd6388ff1c36d79568
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-04-25 23:29 UTC] ab@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85c06f17f3f36d877b1c9ffbe8d68a998b3de4dc
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-05-01 14:59 UTC] tyrael@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=186ffcb72c982b0235761bdd6388ff1c36d79568
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-05-27 05:19 UTC] stas@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91e7b3b84f08a2fabed8ed2196a827e481a4b79c
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-05-27 10:24 UTC] ab@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91e7b3b84f08a2fabed8ed2196a827e481a4b79c
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-05-27 10:26 UTC] ab@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91e7b3b84f08a2fabed8ed2196a827e481a4b79c
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-06-01 15:05 UTC] laruence@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91e7b3b84f08a2fabed8ed2196a827e481a4b79c
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2014-06-04 01:22 UTC] tyrael@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=91e7b3b84f08a2fabed8ed2196a827e481a4b79c
Log: Fix #50444: PDO-ODBC changes for 64-bit
 [2016-07-20 11:40 UTC] davey@php.net
Automatic comment on behalf of kehrigan@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=85c06f17f3f36d877b1c9ffbe8d68a998b3de4dc
Log: Fix #50444: PDO-ODBC changes for 64-bit
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 17:01:28 2024 UTC