|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56882 Seg Fault on execution of bound values
Submitted: 2006-03-07 16:43 UTC Modified: 2006-04-11 10:46 UTC
From: kfbombar at us dot ibm dot com Assigned:
Status: Closed Package: PDO_ODBC (PECL)
PHP Version: 5.1.2 OS: Linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: kfbombar at us dot ibm dot com
New email:
PHP Version: OS:


 [2006-03-07 16:43 UTC] kfbombar at us dot ibm dot com
I found the following piece of code not working correctly.  It was run on RedHat Linux 32 connecting to a DB2 database.  It was run with PHP 5.1.2, and the pdo_odbc 1.0.  This same issue causes an error in ext/pdo/tests/pdo_028.phpt.  Please let me know if you need any further information.

Reproduce code:
$conn = new PDO('odbc:nodename', 'user', 'pass');
$conn->exec('DROP TABLE test');
$conn->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val0 VARCHAR(10), val1 VARCHAR(10))');

/* Prepare, bind, and insert the data into test */
$stmt = $conn->prepare("INSERT INTO test VALUES(1, ?, ?)");
$data = array('AA', 'aa');
foreach ($data as $i => $v) {
    $stmt->bindValue($i+1, $v);

/* Print the contents of test */
$stmt = $conn->prepare('SELECT * from test');

Expected result:
array(1) {
  array(3) {
    string(1) "1"
    string(2) "AA"
    string(2) "aa"

Actual result:
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-23 13:49 UTC] tony2001 at phpclub dot net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2006-03-23 15:00 UTC] kfbombar at us dot ibm dot com
Without --enable-debug, I get this backtrace:

#0  _convert_to_string (op=0x40247f74) at /source/path/php-5.1.2/Zend/zend_operators.c:528
#1  0x403497fb in odbc_stmt_execute (stmt=0x837bf44) at /source/path/php-5.1.2/ext/pdo_odbc/odbc_stmt.c:88
#2  0x4033f00d in zif_PDOStatement_execute (ht=0, return_value=0x837df44, return_value_ptr=0x0, this_ptr=0x836c15c, return_value_used=0)
    at /source/path/php-5.1.2/ext/pdo/pdo_stmt.c:426
#3  0x081a764f in zend_do_fcall_common_helper_SPEC (execute_data=0xbfffca70) at zend_vm_execute.h:192
#4  0x081f12ea in execute (op_array=0x8378e6c) at zend_vm_execute.h:92
#5  0x0818d44f in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /source/path/php-5.1.2/Zend/zend.c:1101
#6  0x081579ee in php_execute_script (primary_file=0xbfffef60) at /source/path/php-5.1.2/main/main.c:1720
#7  0x081f276b in main (argc=2, argv=0xbffff034) at /source/path/php-5.1.2/sapi/cli/php_cli.c:1077

With --enable-debug, I run and get this output:

array(1) {
  array(3) {
    string(1) "1"
    string(0) ""
    string(0) ""
[Thu Mar 23 09:03:22 2006]  Script:  '7054.php'
/source/path/php-5.1.2/Zend/zend_operators.c(517) :  Freeing 0x083A105C (1 bytes), script=7054.php
=== Total 1 memory leaks detected ===
 [2006-04-09 01:38 UTC]
Can you try this with the latest 5.1.x snapshot from
 [2006-04-11 10:46 UTC] kfbombar at us dot ibm dot com
Thank you Wez, looks like with the most up to date PHP build all is well.  Thanks!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon May 10 20:01:23 2021 UTC