php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77132 Issues in PDO_ODBC v1.0.1 using unixODBC v2.3.2
Submitted: 2018-11-09 21:56 UTC Modified: 2018-11-12 20:21 UTC
From: jake dot pogorelec at ntalife dot com Assigned: cmb (profile)
Status: Closed Package: PDO ODBC
PHP Version: 7.1.24 OS: 64-Bit Centos 6
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jake dot pogorelec at ntalife dot com
New email:
PHP Version: OS:

 

 [2018-11-09 21:56 UTC] jake dot pogorelec at ntalife dot com
Description:
------------
Im not sure this is where this belongs but I wasn't sure where to put it so Im posting it here, please let me know if it needs to be somewhere else. We are in the process of upgrading from php 5.6.* to 7.1.* before the EOL early next month and ran into a snag. the snag seems to be due to PHPNG changes https://wiki.php.net/phpng-upgrading) that were made back in 7, but do not have solutions readily available.

Historicall we have used IUS to get compliant packages (Regular redhat repos are too old to be compliant in the ways we need) and the we stimulate those with manually compiled packages. 

One of the packages that we have been maintaining "manually" (building with phpize, configure, "make", & "make install") after each php update is "PDO_ODBC v1.0.1 using unixODBC v2.3.2" (we use this driver manager heavily for DB2 on iSeries, mysql, AND Sql Server database connections). 

The package has built pretty much without issue until the 5->7 upgrade process which has failed and gotten a LOT of errors related to various Zend library methods I have been working my way through with things I can fix, but I dont know how to fix the last few of them (most are related to type mismatches such as "unary *", "zval", "struct zval *", . It seems in 5.6 the Zend functions were alot different although some of the issues we fixed in the previous version (changin SDWORD to SQLULEN, etc...)



Test script:
---------------
cd ./PDO_ODBC-1.0.1
phpize
./configure --with-pdo-odbc=unixODBC
make 

Expected result:
----------------
Successful Build

Actual result:
--------------
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c: In function ‘odbc_stmt_execute’:
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:183: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:186: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:186: error: incompatible type for argument 1 of ‘_convert_to_string’
/usr/include/php/Zend/zend_operators.h:253: note: expected ‘struct zval *’ but argument is of type ‘zval’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:189: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:190: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:193: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:194: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c: In function ‘odbc_stmt_param_hook’:
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:312: warning: passing argument 4 of ‘SQLDescribeParam’ from incompatible pointer type
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:387: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:430: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:430: error: incompatible type for argument 1 of ‘_convert_to_string’
/usr/include/php/Zend/zend_operators.h:253: note: expected ‘struct zval *’ but argument is of type ‘zval’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:432: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:433: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:435: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:438: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:441: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:441: error: incompatible type for argument 1 of ‘_convert_to_string’
/usr/include/php/Zend/zend_operators.h:253: note: expected ‘struct zval *’ but argument is of type ‘zval’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:445: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:446: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:450: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:451: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:459: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:473: error: incompatible type for argument 1 of ‘_zval_ptr_dtor_nogc’
/usr/include/php/Zend/zend_variables.h:37: note: expected ‘struct zval *’ but argument is of type ‘zval’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:474: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:477: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:477: error: incompatible type for argument 1 of ‘_convert_to_string’
/usr/include/php/Zend/zend_operators.h:253: note: expected ‘struct zval *’ but argument is of type ‘zval’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:491: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:491: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:492: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:493: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:494: error: invalid type argument of ‘unary *’ (have ‘zval’)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c: In function ‘odbc_stmt_describe’:
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:552: warning: passing argument 7 of ‘SQLDescribeCol’ from incompatible pointer type
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:592: error: ‘struct pdo_column_data’ has no member named ‘namelen’
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:593: warning: assignment from incompatible pointer type
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:787:34: error: macro "ZVAL_STRINGL" passed 4 arguments, but takes just 3
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c: In function ‘odbc_stmt_get_attr’:
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:787: error: ‘ZVAL_STRINGL’ undeclared (first use in this function)
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:787: error: (Each undeclared identifier is reported only once
/usr/local/lib/PDO_ODBC-1.0.1/odbc_stmt.c:787: error: for each function it appears in.)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-11 15:53 UTC] cmb@php.net
-Summary: Issues in +Summary: Issues in PDO_ODBC v1.0.1 using unixODBC v2.3.2 -Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-11-11 15:53 UTC] cmb@php.net
Is there any particular reason why you don't use the pdo_odbc
extensions which is bundled with PHP?
 [2018-11-12 15:51 UTC] jake dot pogorelec at ntalife dot com
-Status: Feedback +Status: Assigned
 [2018-11-12 15:51 UTC] jake dot pogorelec at ntalife dot com
Can you clarify possibly? The php module "pdo_odbc" (I believe) is just an interface between PHP and the PDO_ODBC-1.0.1 package (the package is what includes odbc.ini and odbcinst.ini, which is how the different databases connections are defined), isn't it? 

I'm a little apprehensive about seeking out a different option because of dependency nonsense that has the potential to destroy any sort of progress.. Also our handles are defined in many many scripts so going through and finding and changing each one would be a very time consuming process..

I wouldnt say Im "completely" opposed to changing, provided the information is available to fix things that come up. but that is definitely not ideal. 

For example, when we started using this current setup there was a pretty major bug related to varchar(max) (It would cause the length of a varchar max field to be reported as -1 and -1 would, in one path, be interpreted as NULL. This null value would cause every other field that followed the field in the select statement to be populated with NULL). This was huge pain to patch/fix.

I would like very much to avoid this type of problems going forward since solving them caused the team a generous amount of stress...
 [2018-11-12 16:16 UTC] cmb@php.net
> Can you clarify possibly? The php module "pdo_odbc" (I believe)
> is just an interface between PHP and the PDO_ODBC-1.0.1 package
> (the package is what includes odbc.ini and odbcinst.ini, which is
> how the different databases connections are defined), isn't it? 

PECL/PDO_ODBC[1] is the precursor of ext/pdo_odbc[2] which is
bundled since PHP 5.1.  PECL/PDO_ODBC is unmaintained for more
than ten years now, so it is not surprising that it doesn't
compile with PHP 7.  ext/pdo_odbc is supposed to work, though.

> For example, when we started using this current setup there was
> a pretty major bug related to varchar(max) […] This was huge pain
> to patch/fix.

I can understand that you're wary about upgrading (and I'm not
even sure that this particular bug has been fixed in the
meantime), but we can't provide support for unmaintained PECL
extensions here.  I suggest that you give the bundled ext/pdo_odbc
a try.  If you find bugs, please report them (if that has not
already been done[3]).  If you can't upgrade, I suggest to ask for
help with PECL/PDO_ODBC 1.0.1 in a more suitable support
channel[4] than this bug tracker.

[1] <https://pecl.php.net/package/PDO_ODBC>
[2] <https://github.com/php/php-src/tree/PHP-5.1/ext/pdo_odbc>
[3] <https://bugs.php.net/search.php?cmd=display&package_name[]=PDO+ODBC>
[4] <http://php.net/support.php>
 [2018-11-12 16:17 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2018-11-12 16:17 UTC] cmb@php.net
Closing this as not a bug.
 [2018-11-12 20:21 UTC] jake dot pogorelec at ntalife dot com
This ended up being EXACTLY what I needed! Thank you so much. It turns out, from your link I was able to get to the same package for 7.1.24 and the files contained there showed me what was missing in the patches I have been doing (They patched/fixed the included pdo_odbc package in the same exact ways I did) https://github.com/php/php-src/tree/PHP-7.1.24/ext/pdo_odbc )

Anyhow everything compiles successfully now and it all appears to be working after my sanity tests. Thank you again!
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 22:01:23 2020 UTC