ID: 35332 Updated by: [EMAIL PROTECTED] Reported By: joh at deworks dot net -Status: Assigned +Status: Closed Bug Type: PDO related Operating System: Linux PHP Version: 5CVS-2005-11-22 (snap) Assigned To: wez New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in CVS. Try the next snapshot to confirm. FYI, the problem stems from you binding parameters both by name and by position. If you change your first execute call to this: $statement->execute(array(':name'=>'date', ':data'=>date('r'))); then PDO won't crash. The fix in CVS allows your original script to run successfully, but you shouldn't rely on being able to mix binding by number and by name on the same statement; some drivers may report invalid parameter name or number when you do that. Previous Comments: ------------------------------------------------------------------------ [2005-11-22 22:32:29] [EMAIL PROTECTED] Assigned to the maintainer. ------------------------------------------------------------------------ [2005-11-22 15:48:10] joh at deworks dot net Actually, the same thing happens when doing: $statement->execute(array('name' => 'date', 'data' => 'Foo!')); ------------------------------------------------------------------------ [2005-11-22 15:45:21] joh at deworks dot net 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 this bug report at http://bugs.php.net/?id=35332&edit=1