From: joh at deworks dot net
Operating system: Linux
PHP version: 5CVS-2005-11-22 (snap)
PHP Bug Type: PDO related
Bug description: Segfault when using PDO: PGSQL and prepared statements with
bindParam()
Description:
------------
PHP segfaults when using PDO: PGSQL and prepared statements with
bindParam() and execute().
Reproduce code:
---------------
$dsn = 'pgsql:...';
$user = '...';
$pass = '...';
$db = new PDO($dsn, $user, $pass);
$statement = $db->prepare("INSERT INTO testinggrounds (name, data) VALUES
(:name, :data)");
$statement->execute(array('date', date('r')));
echo "First statement OK\n";
$statement->bindParam(':name', $name);
$statement->bindParam(':data', $data);
echo "Params bound to PHP variables\n";
// Insert a row
$name = 'date';
$data = 'test';
$statement->execute();
echo "Second statement OK\n";
Expected result:
----------------
First statement OK
Params bound to PHP variables
Second statement OK
Actual result:
--------------
First statement OK
Params bound to PHP variables
Segmentation fault
GDB backtrace:
(gdb) run
Starting program: /usr/local/bin/php PDO_dbg.php
[Thread debugging using libthread_db enabled]
[New Thread -1217852832 (LWP 19309)]
First statement OK
Params bound to PHP variables
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1217852832 (LWP 19309)]
0xb7d9f50a in pqHandleSendFailure () from /usr/lib/libpq.so.4
(gdb) bt
#0 0xb7d9f50a in pqHandleSendFailure () from /usr/lib/libpq.so.4
#1 0xb7da0091 in PQexecPrepared () from /usr/lib/libpq.so.4
#2 0x0813d505 in pgsql_stmt_execute (stmt=0x85b0104, tsrm_ls=0x8439018)
at
/shared/src/php/php5-200511221330/ext/pdo_pgsql/pgsql_statement.c:122
#3 0x0813704a in zif_PDOStatement_execute (ht=0, return_value=0x85b0604,
return_value_ptr=0x0, this_ptr=0x85b3b6c, return_value_used=0,
tsrm_ls=0x8439018)
at /shared/src/php/php5-200511221330/ext/pdo/pdo_stmt.c:424
#4 0x082be11e in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfae2b6c,
tsrm_ls=0x8439018) at zend_vm_execute.h:188
#5 0x082bd70a in execute (op_array=0x859524c, tsrm_ls=0x8439018)
at zend_vm_execute.h:88
#6 0x08298a4e in zend_execute_scripts (type=8, tsrm_ls=0x8439018,
retval=Variable "retval" is not available.
)
at /shared/src/php/php5-200511221330/Zend/zend.c:1090
#7 0x0825affa in php_execute_script (primary_file=0xbfae4f6c,
tsrm_ls=0x8439018) at
/shared/src/php/php5-200511221330/main/main.c:1704
#8 0x08332977 in main (argc=2, argv=0xbfae5054)
at /shared/src/php/php5-200511221330/sapi/cli/php_cli.c:1039
(gdb) bt full
#0 0xb7d9f50a in pqHandleSendFailure () from /usr/lib/libpq.so.4
No symbol table info available.
#1 0xb7da0091 in PQexecPrepared () from /usr/lib/libpq.so.4
No symbol table info available.
#2 0x0813d505 in pgsql_stmt_execute (stmt=0x85b0104, tsrm_ls=0x8439018)
at
/shared/src/php/php5-200511221330/ext/pdo_pgsql/pgsql_statement.c:122
S = (pdo_pgsql_stmt *) 0x85b028c
H = (pdo_pgsql_db_handle *) 0x859a06c
status = Variable "status" is not available.
(gdb)
Thanks
--
Edit bug report at http://bugs.php.net/?id=35332&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35332&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35332&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35332&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35332&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35332&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35332&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35332&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35332&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35332&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35332&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35332&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35332&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35332&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35332&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35332&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35332&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35332&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35332&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35332&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35332&r=mysqlcfg