#46473 [Com]: php segfaults on some queries using pdo_odbc & ibm-db2 on a 64bits platform

[email protected] ("d dot stcyr at streamfoundry dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               46473
 Comment by:       d dot stcyr at streamfoundry dot com
 Reported By:      philippe dot marasse at ac-poitiers dot fr
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Linux Red Hat EL5 x86_64
 PHP Version:      5.2.6
 Assigned To:      iodbc
 New Comment:

Was able to circumvent by configuring (now, PHP 5.2.10) with
--enable-debug.  PHP 5.2.10 without --enable-debug fails the same way as
did 5.2.9.  Can someone advise if this is the same problem and a
prognosis for correction?


Previous Comments:
------------------------------------------------------------------------

[2009-06-24 15:57:26] d dot stcyr at streamfoundry dot com

I believe we have a same/similar situation running PHP 5.2.9 on 64-bit
SLES10 - with the ibm-db2 1.8.2 pdo_odbc extension. Getting a "Child pid
nnn exit signal Segmentation fault (11)". Here is a simple recreate
script trying to connect to the DB2 "SAMPLE" database:

<?php
 $dbconn = new PDO('odbc:SAMPLE','db2inst1','pw'); /* pw not actual pw
*/
?>

Program terminated with signal 11, Segmentation fault.
#0  _zval_ptr_dtor (zval_ptr=0x3fffff31c70)
    at /opt/SFI/php-5.2.9/Zend/zend_execute_API.c:412
412             (*zval_ptr)->refcount--;

Backtrace:
#0  _zval_ptr_dtor (zval_ptr=0x3fffff31c70)
    at /opt/SFI/php-5.2.9/Zend/zend_execute_API.c:412
#1  0x0000020000a36282 in zend_do_fcall_common_helper_SPEC (
    execute_data=0x3fffff31ec0) at
/opt/SFI/php-5.2.9/Zend/zend_execute.h:155
#2  0x0000020000a26992 in execute (op_array=0x20002bb0d90)
    at /opt/SFI/php-5.2.9/Zend/zend_vm_execute.h:92
#3  0x0000020000a032ac in zend_execute_scripts (type=<value optimized
out>,
    retval=0x0, file_count=2) at /opt/SFI/php-5.2.9/Zend/zend.c:1134
#4  0x00000200009ba4c4 in php_execute_script
(primary_file=0x3fffff344d0)
    at /opt/SFI/php-5.2.9/main/main.c:2023
#5  0x0000020000a970c8 in php_handler (r=0x2aaaade5ba8)
    at /opt/SFI/php-5.2.9/sapi/apache2handler/sapi_apache2.c:632
#6  0x000002aaaaaedce0 in ap_run_handler () from
/usr/sbin/httpd2-prefork
#7  0x000002aaaaaf1516 in ap_invoke_handler () from
/usr/sbin/httpd2-prefork
#8  0x000002aaaaafccd8 in ap_process_request () from
/usr/sbin/httpd2-prefork
#9  0x000002aaaaafa08c in ?? () from /usr/sbin/httpd2-prefork
#10 0x000002aaaaaf55b4 in ap_run_process_connection ()
   from /usr/sbin/httpd2-prefork
#11 0x000002aaaab01190 in ?? () from /usr/sbin/httpd2-prefork
#12 0x000002aaaab014b0 in ?? () from /usr/sbin/httpd2-prefork
#13 0x000002aaaab0158a in ?? () from /usr/sbin/httpd2-prefork
#14 0x000002aaaab021d4 in ap_mpm_run () from /usr/sbin/httpd2-prefork
#15 0x000002aaaaad8646 in main () from /usr/sbin/httpd2-prefork

Please let me know if this falls within the known exposure of the work
being done on this bug. And a status?

Thanks.

------------------------------------------------------------------------

[2009-04-25 15:15:16] [email protected]

iodbc: What is the status with this fix? (if this still isn't fixed, 
please update the PHP version..)

------------------------------------------------------------------------

[2008-11-07 11:45:59] [email protected]

I am working on a fix for pdo_odbc to bring it up to ODBC 3.51 API 
specification including full 64bit support, similar to the work i did
on 
the regular ext/odbc code.

------------------------------------------------------------------------

[2008-11-03 15:35:13] philippe dot marasse at ac-poitiers dot fr

Description:
------------
On our both platforms (32 & 64 bits), we have php compiled with support
for IBM DB2 database via pdo_odbc extension. We ran into unexpected
segfaults deploying a new application on a 64 bits server.

We have tested several client version of DB2 but nothing helped.

At last, it seemed that pdo_odbc extensions did not compile properly,
as we got several warnings like :

passing argument 2 of 'SQLRowCount' from incompatible pointer type

Bug #32830 (related to odbc, not pdo_odbc) points out the same issue.

We wrote a little patch that works for us (tm), available at :

http://huan.ac-poitiers.fr/pdo_odbc_db2-x86_64.patch

Rgds.

Reproduce code:
---------------
<?php
  $toto = new PDO("odbc:mydb","user","password");
  $req = "SELECT ETA_DENOMINATION FROM ETABLISSEMENT WHERE
ETA_DEPARTEMENT = 16 AND ETA_RNE = '0160001P'";
  $machin = $toto->query($req);
  $truc = $machin->fetchObject();
?>


Expected result:
----------------
nothing indeed :-), it's just a script we used to isolate a query which
crashes only on our 64bits servers (of course, it works fine on 32bits
platform).

Actual result:
--------------
segfault... unless the value of ETA_DENOMINATION is not NULL.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46473&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.