ID: 45933
User updated by: alexc223 at googlemail dot com
-Summary: Segfault var_dumo PDOStatement Obj with die
Reported By: alexc223 at googlemail dot com
Status: Open
Bug Type: PDO related
Operating System: Arch Linux
PHP Version: 5.2.6
New Comment:
This line:
$pdo_st = $sql->prepare( 'SELECT * FROM foobar' );
Should read:
$pdo_st = $sql->prepare( 'SELECT * FROM foobar WHERE zomg = :zomg' );
However, both still produce a segfault.
Previous Comments:
------------------------------------------------------------------------
[2008-08-27 11:02:20] alexc223 at googlemail dot com
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 this bug report at http://bugs.php.net/?id=45933&edit=1