|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 11:00:01 2025 UTC |
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 ===