From:
Operating system: Linux 2.6.32-5-amd64
PHP version: 5.4.0
Package: PDO related
Bug Type: Bug
Bug description:PDO Segfaults with PERSISTENT == TRUE && EMULATE_PREPARES ==
FALSE
Description:
------------
PDO Segfaults or hangs when a statement is executed with both
ATTR_PERSISTENT =>
TRUE and ATTR_EMULATE_PREPARES => FALSE
The exact bug is actually :
*** glibc detected *** /usr/local/php-5.4.0/bin/php: free(): invalid
pointer:
0x00007ff976ee84c8 ***
But from my tests yesterday I have seen a segfault and a double free, that
I
can't reproduce today, only the invalid pointer.
Playing with PERSISTENT and EMULATE_PREPARE with the given test script give
:
| ATTR_PERSISENT | ATTR_EMULATE_PREPARES | WORKS |
| FALSE | FALSE | YES |
| FALSE | TRUE | YES |
| TRUE | FALSE | free() invalid pointer |
| TRUE | TRUE | YES |
Configure command :
./configure' '--enable-fpm' '--prefix=/usr/local/php-5.4.0'
'--enable-mbstring'
'--enable-gd-native-ttf' '--enable-zip' '--with-mcrypt' '--with-openssl'
'--
with-gd' '--with-jpeg-dir=/usr/lib' '--with-freetype-dir' '--with-curl'
'--with-
pcre-regex' '--with-gettext' '--without-sqlite' '--without-sqlite3'
'--with-pdo-
mysql=mysqlnd' '--disable-rpath' '--disable-debug' '--disable-fileinfo'
'--
without-pdo-sqlite' '--disable-phar' '--disable-posix'
'--disable-tokenizer' '--
disable-xmlreader' '--disable-xmlwriter' '--without-pear'
Same bug reproduced in php 5.3.8 and php 5.3.10
Test script:
---------------
<?php
$options = array(PDO::ATTR_PERSISTENT => TRUE,
PDO::ATTR_EMULATE_PREPARES => FALSE);
$pdo = new PDO('mysql:host=sql;dbname=??;charset=utf8',
'??', '??', $options);
$statement = $pdo->prepare("SELECT count(*) from a_table");
$statement->execute();
foreach ($statement as $line)
var_dump($line);
Expected result:
----------------
I expect PHP not to segfault
Actual result:
--------------
*** glibc detected *** /usr/local/php-5.4.0/bin/php: free(): invalid
pointer:
0x00007ff976ee84c8 ***
--
Edit bug report at https://bugs.php.net/bug.php?id=61411&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61411&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61411&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61411&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61411&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61411&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61411&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61411&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61411&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61411&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61411&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61411&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61411&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61411&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61411&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61411&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61411&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61411&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61411&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61411&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61411&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61411&r=mysqlcfg