php.net |  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
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: 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
Description:
------------
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);
}
$stmt->execute();

/* Print the contents of test */
$stmt = $conn->prepare('SELECT * from test');
$stmt->execute();
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
?>


Expected result:
----------------
array(1) {
  [0]=>
  array(3) {
    ["ID"]=>
    string(1) "1"
    ["VAL0"]=>
    string(2) "AA"
    ["VAL1"]=>
    string(2) "aa"
  }
}

Actual result:
--------------
Segmentation fault

Patches

Pull Requests

History

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
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php 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) {
  [0]=>
  array(3) {
    ["ID"]=>
    string(1) "1"
    ["VAL0"]=>
    string(0) ""
    ["VAL1"]=>
    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] wez@php.net
Can you try this with the latest 5.1.x snapshot from http://snaps.php.net?
 [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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC