From: alexc223 at googlemail dot com
Operating system: Arch Linux
PHP version: 5.2.6
PHP Bug Type: PDO related
Bug description: Segfault var_dumo PDOStatement Obj with die
Description:
------------
Attempting to 'var_dump' a PDOStatement object within a function, and then
calling 'die' using PDO_MYSQL. MySQL query at the top is just incase you
need to test it with that to, though I can re-produce this with any table
and MySQL database.
Reproduce code:
---------------
CREATE TABLE foobar (
zomg varchar(255) NOT NULL,
KEY zomg (zomg)
) TYPE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
<?php
function foo( $bar ) {
var_dump( $bar );
// Removing the following line stops the segfault from happening
die;
}
$sql = new PDO( 'mysql:host=localhost;dbname=DATABASE', 'USER', 'PASS'
);
$pdo_st = $sql->prepare( 'SELECT * FROM foobar' );
foo( $pdo_st );
?>
Expected result:
----------------
object(PDOStatement)#2 (1) { ["queryString"]=> string(39) "SELECT * FROM
foobar WHERE zomg = :zomg" }
Actual result:
--------------
Output from gdb (unable to enable debug within PHP)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7b5c910 (LWP 3489)]
0xb706323d in mysql_more_results () from /usr/lib/libmysqlclient.so.15
(gdb) bt
#0 0xb706323d in mysql_more_results () from
/usr/lib/libmysqlclient.so.15
#1 0xb6eb6911 in free_statement (stmt=0x991c870) at
/tmp/pear/temp/PDO/pdo_stmt.c:2200
#2 0xb6eb6a9d in pdo_dbstmt_free_storage (stmt=0x991c870) at
/tmp/pear/temp/PDO/pdo_stmt.c:2245
#3 0xb78921ed in zend_objects_store_free_object_storage () from
/etc/httpd/modules/libphp5.so
#4 0xb786b013 in shutdown_executor () from /etc/httpd/modules/libphp5.so
#5 0xb7875783 in zend_deactivate () from /etc/httpd/modules/libphp5.so
#6 0xb7833547 in php_request_shutdown () from
/etc/httpd/modules/libphp5.so
#7 0xb78e0cc1 in php_handler () from /etc/httpd/modules/libphp5.so
#8 0x0807be49 in ap_run_handler ()
#9 0x0807f1b1 in ap_invoke_handler ()
#10 0x0808a496 in ap_process_request ()
#11 0x080875c8 in ?? ()
#12 0x0997fc00 in ?? ()
#13 0x00000004 in ?? ()
#14 0x0997fc00 in ?? ()
#15 0x00000000 in ?? ()
--
Edit bug report at http://bugs.php.net/?id=45933&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45933&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45933&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45933&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45933&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45933&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45933&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45933&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45933&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45933&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45933&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45933&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45933&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45933&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45933&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45933&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45933&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45933&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45933&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45933&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45933&r=mysqlcfg