php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56827 Segfault when executing parameterised query
Submitted: 2006-02-07 11:16 UTC Modified: 2006-03-16 17:03 UTC
From: martin dot hutchins at bluesq dot com Assigned: kfbombar (profile)
Status: Closed Package: PDO_INFORMIX (PECL)
PHP Version: 5.1.0 OS: Solaris 9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martin dot hutchins at bluesq dot com
New email:
PHP Version: OS:

 

 [2006-02-07 11:16 UTC] martin dot hutchins at bluesq dot com
Description:
------------
PHP 5.1.1 and pdo_informix 1.0.0 on Solaris 9..

PHP segfaults when trying to 
When trying to execute prepared, parameterized SQL.

It seems the driver_data structure pointer gets nullified somewhere where it shouldnt(!?) I *suspect* something v odd happened in stmt_bind_parameter()...

Any help appreciated!

Reproduce code:
---------------
<?php
 
        $db = new PDO("informix:database=martin; server=test1_dbs; EnableScrollableCursors=1", "test", "test");
 
        echo "Dumping db\n";
        var_dump($db);
 
        $stmt = $db->prepare('select tabname from systables where tabname = :p_name' );
 
        echo "Dumping stmt\n";
        var_dump($stmt);
 
        $x = $stmt->execute(array(':p_name' => "systables"));
 
        echo "Dumping x\n";
        var_dump($x);
 
        $stmt = null;
        $db = null;
        echo "All done\n";
?>


Actual result:
--------------
I get:
 
Dumping db
object(PDO)#1 (0) {
}
Dumping stmt
object(PDOStatement)#2 (1) {
  ["queryString"]=>
  string(53) "select tabname from systables where tabname = :p_name"
}
Segmentation Fault(coredump)

I tried to get a backtrace.....
 
#0  0x00125604 in stmt_parameter_pre_execute (stmt=0x69b888, curr=0x6d2a78)
    at /opt/php-5.1.2/ext/pdo_informix/informix_statement.c:409
409                             if (param_res->ctype == SQL_C_LONG)
(gdb) 
(gdb) bt
#0  0x00125604 in stmt_parameter_pre_execute (stmt=0x69b888, curr=0x6d2a78)
    at /opt/php-5.1.2/ext/pdo_informix/informix_statement.c:409
#1  0x00126550 in informix_stmt_param_hook (stmt=0x69b888, param=0x6d2a78, 
    event_type=6933776) at /opt/php-5.1.2/ext/pdo_informix/informix_statement.c:745
#2  0x00117310 in dispatch_param_event (stmt=0x69b888, event_type=7154296)
    at /opt/php-5.1.2/ext/pdo/pdo_stmt.c:149


 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-01 17:05 UTC] kfbombar at us dot ibm dot com
I have set up pdo_informix on Solaris and I did not have any problems with the code you supplied.  Can you supply me with any more information on your setup/environment?  Are you using the most recent release of pdo_informix?
 [2006-03-06 08:30 UTC] martin dot hutchins at bluesq dot com
Additional version information: PHP/PDO/PDO_INFORMIX already supplied. Informix IDS 7.31.UD3 CSDK 2.90.UD3.

I have tracked this down to a failing call to SQLDescribeParam() from stmt_get_parameter_info(). This causes
curr->driver_data to become a null pointer, eventualy blowing up in stmt_parameter_pre_execute() (as described by gdb).

I found this note on SQLDescribeParam():

http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.odbc.doc/odbcmst60.htm
 [2006-03-16 17:03 UTC] kfbombar at us dot ibm dot com
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC