|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-23 04:22 UTC] wez@php.net
[2005-07-24 02:40 UTC] james at safesearching dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
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