I'm reusing a variable to store two different PDO mysql statements:
$stmt=$dbh->prepare("SELECT ....");
$stmt->execute();
$stmt=$dbh->prepare("UPDATE ....");
//crash here:
//*** Error in `/opt/lampp/bin/httpd': free(): invalid pointer: 0xf4a028dc ***
//*** Error in `/opt/lampp/bin/httpd': free(): invalid pointer: 0xf4a028dc ***
//[Mon Jun 03 19:53:48.691674 2013] [core:notice] [pid 20249] AH00052: child pid 25933 exit //signal Aborted (6)
//[Mon Jun 03 19:53:48.691727 2013] [core:notice] [pid 20249] AH00052: child pid 25952 exit //signal Aborted (6)
but if instead I use $stmt2=$dbh->prepare("UPDATE ...."); nothing weird happens and the statment executes alright. It also goes without trouble if I enable prepare emulation:
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES,true);
I tried $stmt->closeCursor()
after executing the first statement and also unset($stmt)
(and also both of them), producing the same crash. I'm using PHP 5.4.7. Why does this happen? Is it a bug or a really weird feature?
[UPDATE] I switched from xampp to OpenSUSE 12.3 default Apache (2.2.22) and PHP (5.3.17) and still get the same error, but a more detailed dump log: http://paste2.org/d0BtdOHI
[UPDATE 2] I've also confirmed it happens when using MySQL 5.5.27 instead of MariaDB 5.5.29 as a server, so it's definetly comming from my script and pretty much universal (going to try also a centos virtual machine just in case it's some glibc related issue from my distro...), happening with different versions of apache, mysql and php, but still don't have a clue of what can be the cause...
[UPDATE 3] Well it seems CentOS 6.4 is much nicer about it and lets me run my script without any troubles at all, and since it's what I'm using on production I guess there's nothing to worry about. Anyway I would really like to know what's happening here...