php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43445 Segfault when selecting from a "long" column using Odbc with TimesTen driver
Submitted: 2007-11-29 10:36 UTC Modified: 2009-05-03 01:00 UTC
From: akoebel at capgemini dot fr Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.6 OS: Ubuntu 7.10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-11-29 10:36 UTC] akoebel at capgemini dot fr
Description:
------------
We're having some difficulties using PDO
in conjunction with Oracle TimesTen 7.03 ODBC driver
and long column datatypes.

Oracle table :
CREATE TABLE TEST (ID NUMBER(10) NOT NULL PRIMARY KEY,DATA LONG NOT NULL);

INSERT INTO TEST VALUES (1,'sample');

TimesTen :
CREATE READONLY CACHE GROUP FROM TEST (ID NUMBER(10) NOT NULL PRIMARY KEY, DATA VARCHAR(256000);

Note that timesten doesn't support the long datatype directly.

Odbc.ini : 
[myDSN]
Datastore=/home/sieadmin/tt
PermSize=100
TempSize=100
UID=test
OracleId=XE
OraclePwd=test
DatabaseCharacterSet=WE8MSWIN1252

[testClient]
DRIVER = /opt/TimesTen/tt70/lib/libtten.so
DataStore=/home/sieadmin/tt
PermSize=100

PHP File : 

<html><head><title>PDO</title></head>
<body>
 <?php
$conn=new PDO('odbc:testClient','test','test');
$sql="SELECT ID, DATA FROM TEST";
$rs=$conn->prepare($sql);
$rs->execute();

while ($res=$rs->fetch()) {
 print_r($res);
}
$conn=null;
?>
</body>
</html>

This script was executed on these platforms:
-Ubuntu 7.10 with PHP5.2.3 PDO/unixODBC, TimesTen ODBC Driver
-Ubuntu 7.10 with PHP5.2.3 PDO/unixODBC, Oracle ODBC Driver
-Ubuntu 7.10 with PHP5.2.3 ODBC, TimesTen Driver
-Windows with PHP5.2.3 PDO, TimesTen Driver
-Windows with PHP5.2.5 PDO, TimesTen Driver

On Ubuntu with PDO and the timesten driver, the script segfaults, unless the long column is restricted to less than 255 characters (with a SUBSTR in the SQL query).

On windows, the script doesn't segfaults, but no data is displayed from the long column, wether it is over or under 255 chars long.

Other configurations (using odbc instead of PDO or using the Oracle driver instead of the TimesTen driver) work well

Unix backtrace (without PHP debug):

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1216518480 (LWP 5544)]
0xb6f719d6 in ?? () from /usr/lib/libodbccr.so.1
(gdb) bt
#0  0xb6f719d6 in ?? () from /usr/lib/libodbccr.so.1
#1  0x083c7310 in ?? ()
#2  0x00000001 in ?? ()
#3  0x00000001 in ?? ()
#4  0x00000001 in ?? ()
#5  0x00000001 in ?? ()
#6  0x0000000e in ?? ()
#7  0x00000000 in ?? ()



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-29 14:51 UTC] akoebel at capgemini dot fr
Tested today with version 5.2.6 from november 27th, 2007

PHP was compiled with debugging enabled and pdo-odbc=unixOdbc

unixOdbc was version 2.2.12

Here's the backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1216276816 (LWP 10102)]
0xb72439c5 in extract_sql_error_rec (head=0x8392858,
    sqlstate=0xbf8e3a93 "00000", rec_number=1, native_error=0xbf8e3a98,
    message_text=0xbf8e3ab8 "ocket_sendto", buffer_length=1023,
    text_length=0xbf8e3ab0) at SQLGetDiagRec.c:440
440                 as1 = (SQLCHAR*) unicode_to_ansi_alloc( ptr -> msg, SQL_NTS, __get_connection( head ));
(gdb) bt
#0  0xb72439c5 in extract_sql_error_rec (head=0x8392858,
    sqlstate=0xbf8e3a93 "00000", rec_number=1, native_error=0xbf8e3a98,
    message_text=0xbf8e3ab8 "ocket_sendto", buffer_length=1023,
    text_length=0xbf8e3ab0) at SQLGetDiagRec.c:440
#1  0xb724468d in SQLGetDiagRec (handle_type=3, handle=0x8392430,
    rec_number=2, sqlstate=0xbf8e3a93 "00000", native=0xbf8e3a98,
    message_text=0xbf8e3ab8 "ocket_sendto", buffer_length=1023,
    text_length_ptr=0xbf8e3ab0) at SQLGetDiagRec.c:741
#2  0xb746694d in pdo_odbc_error (dbh=0x82e78a4, stmt=0x82e9638,
    statement=0x8392430, what=0xb7771b9d "SQLFetchScroll",
    file=0xb7771ac8 "/home/sieadmin/php5.2-200711271530/ext/pdo_odbc/odbc_stmt.c", line=375, tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/ext/pdo_odbc/odbc_driver.c:120
#3  0xb7468a9a in odbc_stmt_fetch (stmt=0x82e9638, ori=PDO_FETCH_ORI_NEXT,
    offset=0, tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/ext/pdo_odbc/odbc_stmt.c:375
#4  0xb745e329 in do_fetch_common (stmt=0x82e9638, ori=PDO_FETCH_ORI_NEXT,
    offset=0, do_bind=1, tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/ext/pdo/pdo_stmt.c:669
#5  0xb745f764 in do_fetch (stmt=0x82e9638, do_bind=1, return_value=0x82e9114,
    how=PDO_FETCH_BOTH, ori=PDO_FETCH_ORI_NEXT, offset=0, return_all=0x0,
    tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/ext/pdo/pdo_stmt.c:903
#6  0xb7461025 in zim_PDOStatement_fetch (ht=0, return_value=0x82e9114,
    return_value_ptr=0x0, this_ptr=0x82e9094, return_value_used=1,
    tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/ext/pdo/pdo_stmt.c:1342
#7  0xb76a47ea in zend_do_fcall_common_helper_SPEC (execute_data=0xbf8e4360,
    tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/Zend/zend_vm_execute.h:200
#8  0xb76a57e3 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0xbf8e4360,
    tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/Zend/zend_vm_execute.h:322
#9  0xb76a4284 in execute (op_array=0x82e77e8, tsrm_ls=0x8135388)
    at /home/sieadmin/php5.2-200711271530/Zend/zend_vm_execute.h:92
#10 0xb767b7e5 in zend_execute_scripts (type=8, tsrm_ls=0x8135388, retval=0x0,
    file_count=3) at /home/sieadmin/php5.2-200711271530/Zend/zend.c:1134
#11 0xb761596c in php_execute_script (primary_file=0xbf8e66cc,
    tsrm_ls=0x8135388) at /home/sieadmin/php5.2-200711271530/main/main.c:2004
#12 0xb770438e in php_handler (r=0x831f1c0)
    at /home/sieadmin/php5.2-200711271530/sapi/apache2handler/sapi_apache2.c:631
#13 0x08079259 in ap_run_handler ()
#14 0x0807c5b7 in ap_invoke_handler ()
#15 0x08089998 in ap_process_request ()
#16 0x08086c9b in ?? ()
#17 0x0831f1c0 in ?? ()
#18 0x00000004 in ?? ()
#19 0x0831f1c0 in ?? ()
#20 0x00000000 in ?? ()
 [2008-06-16 21:53 UTC] csa at dside dot dyndns dot org
I think it could be caused by bug #42765,
http://bugs.php.net/bug.php?id=42765
 [2009-04-25 14:52 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 12:01:32 2024 UTC