#33832 [NEW]: segfault with PDO_MYSQL_ATTR_USE_BUFFERED_QUERY
| From: | james at safesearching dot com | Date: | Sat, 23 Jul 2005 01:25:19 +0000 |
| Subject: | #33832 [NEW]: segfault with PDO_MYSQL_ATTR_USE_BUFFERED_QUERY | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-82347@lists.php.net to get a copy of this message | ||
From: james at safesearching dot com
Operating system: *
PHP version: 5.1.0b3
PHP Bug Type: PDO related
Bug description: segfault with PDO_MYSQL_ATTR_USE_BUFFERED_QUERY
Description:
------------
Getting a segfault with the PDO_MYSQL_ATTR_USE_BUFFERED_QUERY attribute
set to true.
$db = new PDO;
$stmt = $db->prepare();
$stmt->execute();
$db->prepare();
... the above fills PDO::errorInfo() with an error "Cannot execute queries
while other unbuffered queries are active. Consider using
PDOStatement::fetchAll(). Alternatively, if your code is only ever going
to run against mysql, you may enable query buffering by setting the
PDO_MYSQL_ATTR_USE_BUFFERED_QUERY attribute."
When calling $db->setAttribute(PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, true) I
get a segfault.
Calling $stmt->closeCursor() after the first execute with the
USE_BUFFERED_QUERY attribute still 'causes a segfault. Without the
USE_BUFFERED_QUERY attribute, the above error goes away, there's not
segfault, and everything works as expected.
Reproduce code:
---------------
$db = new PDO(
'mysql:dbname=test;host=localhost',
'user',
'secret'
);
$db->setAttribute(PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$stmt = $db->prepare('SHOW TABLES');
$stmt->execute();
$stmt = $db->prepare('SHOW TABLES');
print_r($db->errorInfo());
Expected result:
----------------
No segfault
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 30628)]
0x080c6085 in pdo_mysql_stmt_execute (stmt=0x84c5b14)
at /home/james/php/ext/pdo_mysql/mysql_statement.c:102
102 switch (S->fields[i].type)
{
(gdb) bt
#0 0x080c6085 in pdo_mysql_stmt_execute (stmt=0x84c5b14)
at /home/james/php/ext/pdo_mysql/mysql_statement.c:102
#1 0x080c0979 in zif_PDOStatement_execute (ht=0, return_value=0x84c5a3c,
return_value_ptr=0x0, this_ptr=0x84c5ab4, return_value_used=0)
at /home/james/php/ext/pdo/pdo_stmt.c:395
#2 0x081bdb97 in execute_internal (execute_data_ptr=0xbfffced0,
return_value_used=0) at /home/james/php/Zend/zend_execute.c:1324
#3 0x40409795 in xdebug_execute_internal
(current_execute_data=0xbfffced0,
return_value_used=0) at /home/james/xdebug/xdebug.c:1223
#4 0x081be08b in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffced0)
at /home/james/php/Zend/zend_vm_execute.h:186
#5 0x081bdca1 in execute (op_array=0x84c5584)
at /home/james/php/Zend/zend_vm_execute.h:87
#6 0x404095c8 in xdebug_execute (op_array=0x84c5584)
at /home/james/xdebug/xdebug.c:1166
#7 0x081a09b4 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/james/php/Zend/zend.c:1087
#8 0x08170916 in php_execute_script (primary_file=0xbffff2d0)
at /home/james/php/main/main.c:1672
#9 0x08235154 in main (argc=2, argv=0xbffff384)
at /home/james/php/sapi/cli/php_cli.c:1039
#10 0x42017589 in __libc_start_main () from /lib/i686/libc.so.6
--
Edit bug report at http://bugs.php.net/?id=33832&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33832&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33832&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33832&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33832&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33832&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33832&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33832&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33832&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33832&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33832&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33832&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33832&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33832&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33832&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33832&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33832&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33832&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33832&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33832&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33832&r=mysqlcfg