|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51870 PDO::fetchAll after a PDO::execute with bindings lead to a segv.
Submitted: 2010-05-20 11:44 UTC Modified: 2010-05-25 10:46 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: Assigned: mysql (profile)
Status: Closed Package: PDO related
PHP Version: 6SVN-2010-05-20 (SVN) OS: Mac OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2010-05-20 11:44 UTC]
#0  0x00007fff83c74886 in __kill ()
#1  0x00007fff83d14eae in abort ()
#2  0x00007fff83c2ca75 in free ()
#3  0x00000001001b8328 in pdo_mysql_stmt_fetch (stmt=0x100d3ef18, 
ori=PDO_FETCH_ORI_NEXT, offset=0) at 
#4  0x00000001001ac47a in do_fetch_common (stmt=0x100d3ef18, 
ori=PDO_FETCH_ORI_NEXT, offset=0, do_bind=1) at 
#5  0x00000001001adaa1 in do_fetch (stmt=0x100d3ef18, do_bind=1, 
return_value=0x100d4eff8, how=PDO_FETCH_BOTH, ori=PDO_FETCH_ORI_NEXT, offset=0, 
return_all=0x0) at /Users/dsp/dev/c/php/trunk/ext/pdo/pdo_stmt.c:861
#6  0x00000001001b0388 in zim_PDOStatement_fetchAll (ht=0, 
return_value=0x100d3f888, return_value_ptr=0x0, this_ptr=0x100d3a120, 
return_value_used=0) at 
#7  0x0000000100465e48 in execute_internal (execute_data_ptr=0x101b2a080, 
return_value_used=0) at /Users/dsp/dev/c/php/trunk/Zend/zend_execute.c:1468
#8  0x00000001004176d7 in dtrace_execute_internal (execute_data_ptr=0x101b2a080, 
return_value_used=0) at /Users/dsp/dev/c/php/trunk/Zend/zend_dtrace.c:99
#9  0x0000000100467b04 in zend_do_fcall_common_helper_SPEC 
(execute_data=0x101b2a080) at zend_vm_execute.h:359
#10 0x0000000100468eeb in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER 
(execute_data=0x101b2a080) at zend_vm_execute.h:467
#11 0x00000001004663af in execute (op_array=0x100d3c030) at 
#12 0x00000001004175e2 in dtrace_execute (op_array=0x100d3c030) at 
#13 0x000000010042fb2d in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) at /Users/dsp/dev/c/php/trunk/Zend/zend.c:1210
#14 0x00000001003a31fd in php_execute_script (primary_file=0x7fff5fbfe9f0) at 
#15 0x000000010056caf4 in main (argc=2, argv=0x7fff5fbfeb98) at 

Test script:

$pdo = new PDO('mysql:dbname=mysql;host=', 'root', '');
$stm = $pdo->prepare('SELECT * FROM user WHERE host = ?');

Actual result:
php(63324) malloc: *** error for object 0x101c849a8: pointer being freed was not 
*** set a breakpoint in malloc_error_break to debug
[1]    63324 abort      php test.php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-20 13:42 UTC]
-Status: Open +Status: Feedback
 [2010-05-20 13:42 UTC]
Please try using this snapshot:
For Windows:

 [2010-05-20 13:43 UTC]
erm, this should have been
 [2010-05-20 13:46 UTC]
Sorry I forgot to add my configure:

'./configure' \
'--with-mysql=mysqlnd' \
'--with-pdo-mysql=mysqlnd' \
 [2010-05-20 22:00 UTC]
-Status: Feedback +Status: Open
 [2010-05-21 09:21 UTC]
Hunting down the bug it seems that 

mysqlnd.collect_memory_statistics = On

causes troubles.
 [2010-05-21 13:09 UTC]
Automatic comment from SVN on behalf of andrey
Log: Fix for Bug #51870
PDO::fetchAll after a PDO::execute with bindings lead to a segv.

It is only in unreleased code and thus doesn't deserve a NEWS entry
 [2010-05-21 13:09 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: mysql
 [2010-05-21 13:09 UTC]
Fixed in SVN, thank you for your report!
 [2010-05-21 19:47 UTC] dave at hobodave dot com
This still exists in the latest snapshot php5.3-201005211630.tar.gz


$pdo = new PDO('mysql:dbname=test;host=localhost', 'root', '');
$stm = $pdo->prepare('SHOW FULL TABLES');
 [2010-05-21 19:55 UTC] dave at hobodave dot com
#0  0x00007fff82410886 in __kill ()
#1  0x00007fff824b0eae in abort ()
#2  0x00007fff823c8a75 in free ()
#3  0x00000001020eefc5 in pdo_mysql_stmt_fetch ()
#4  0x000000010008bffe in do_fetch_common ()
#5  0x000000010008c107 in do_fetch ()
#6  0x000000010008e3bf in zim_PDOStatement_fetchAll ()
#7  0x000000010020359a in zend_do_fcall_common_helper_SPEC ()
#8  0x00000001001ff93b in execute ()
#9  0x00000001001db29b in zend_execute_scripts ()
#10 0x0000000100183d62 in php_execute_script ()
#11 0x000000010026c985 in main ()
 [2010-05-21 20:12 UTC]
-Status: Closed +Status: Assigned
 [2010-05-21 20:12 UTC]
re-open after comment from dave.
 [2010-05-21 21:28 UTC] dave at hobodave dot com
Please disregard my previous comments. My environment was screwed, and an old 
pdo_mysql version was being loaded dynamically.
 [2010-05-25 10:46 UTC]
-Status: Assigned +Status: Closed
 [2010-05-25 10:46 UTC]
As Dave says, its been his env fooling him
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 08:03:14 2021 UTC