Bug #51870 [Opn]: PDO::fetchAll after a PDO::execute with bindings lead to a segv.

From: Date: Fri, 21 May 2010 07:21:49 +0000
Subject: Bug #51870 [Opn]: PDO::fetchAll after a PDO::execute with bindings lead to a segv.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150684@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51870&edit=1

 ID:               51870
 Updated by:       dsp@php.net
 Reported by:      dsp@php.net
 Summary:          PDO::fetchAll after a PDO::execute with bindings lead
                   to a segv.
 Status:           Open
 Type:             Bug
 Package:          PDO related
 Operating System: Mac OS X
 PHP Version:      6SVN-2010-05-20 (SVN)

 New Comment:

Hunting down the bug it seems that 

mysqlnd.collect_memory_statistics = On

causes troubles.


Previous Comments:
------------------------------------------------------------------------
[2010-05-20 13:46:45] dsp@php.net

Sorry I forgot to add my configure:

'./configure' \
'--with-mysql=mysqlnd' \
'--with-pdo-mysql=mysqlnd' \

------------------------------------------------------------------------
[2010-05-20 13:43:54] mike@php.net

erm, this should have been http://snaps.php.net/php-trunk-latest.tar.gz

------------------------------------------------------------------------
[2010-05-20 13:42:38] mike@php.net

Please try using this snapshot:

  http://snaps.php.net/php6.0-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2010-05-20 11:44:53] dsp@php.net

Description:
------------
#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 
/Users/dsp/dev/c/php/trunk/ext/pdo_mysql/mysql_statement.c:655
#4  0x00000001001ac47a in do_fetch_common (stmt=0x100d3ef18, 
ori=PDO_FETCH_ORI_NEXT, offset=0, do_bind=1) at 
/Users/dsp/dev/c/php/trunk/ext/pdo/pdo_stmt.c:694
#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 
/Users/dsp/dev/c/php/trunk/ext/pdo/pdo_stmt.c:1560
#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 
zend_vm_execute.h:129
#12 0x00000001004175e2 in dtrace_execute (op_array=0x100d3c030) at 
/Users/dsp/dev/c/php/trunk/Zend/zend_dtrace.c:75
#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 
/Users/dsp/dev/c/php/trunk/main/main.c:2324
#15 0x000000010056caf4 in main (argc=2, argv=0x7fff5fbfeb98) at 
/Users/dsp/dev/c/php/trunk/sapi/cli/php_cli.c:1200

Test script:
---------------
<?php

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

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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51870&edit=1


Thread (12 messages)

« previous php.bugs (#150684) next »