php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45933 Segfault var_dump PDOStatement Obj with die
Submitted: 2008-08-27 11:02 UTC Modified: 2008-09-04 01:00 UTC
From: alexc223 at googlemail dot com Assigned: mysql (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.2.6 OS: Arch Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alexc223 at googlemail dot com
New email:
PHP Version: OS:

 

 [2008-08-27 11:02 UTC] 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 ?? ()


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-27 11:10 UTC] alexc223 at googlemail dot com
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.
 [2008-08-27 11:34 UTC] johannes@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.3-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.3-win32-installer-latest.msi

Could you please try using a 5.3 snapshot, we did quite much work on the PDO_MYSQL driver there. Thanks.
 [2008-09-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 22:01:34 2025 UTC