php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38632 Segmentation fault with PDO/mysql
Submitted: 2006-08-28 16:41 UTC Modified: 2006-08-28 17:11 UTC
From: chris dot vigelius at gmx dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.5 OS: Linux 2.6.16 (SUSE 10.1)
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: chris dot vigelius at gmx dot net
New email:
PHP Version: OS:

 

 [2006-08-28 16:41 UTC] chris dot vigelius at gmx dot net
Description:
------------
when executing the code below, PHP will crash with a segmentation fault.

Note: To reproduce the crash, the database "test" must exist and contain a table "user" with an entry with id=1 (or to put it differently: the query must at least return one result).

Versions of software used: 
mysql 5.0.18
php 5.1.6


Reproduce code:
---------------
<?php

class test {
  protected static $dbh;
  protected function connect() {
     self::$dbh = new PDO('mysql:host=localhost;dbname=test', 'test', 'test');
  }

  public function read($uid) {
     self::connect();
     $stmt = self::$dbh->prepare("SELECT * FROM user WHERE id = :uid");
     $result = $stmt->execute(array(':uid' => 1));
     $rows = $result->fetchAll(PDO::FETCH_OBJ);
     var_dump($result, $rows);
  }
 }

 $t = new test();
 $t->read(1);

Expected result:
----------------
some error messages, but no segfault

Actual result:
--------------
segmentation fault:
PHP Fatal error:  Call to a member function fetchAll() on a non-object in /home/chris/workspace/testing/crash.php on line 19

Fatal error: Call to a member function fetchAll() on a non-object in /home/chris/workspace/testing/crash.php on line 19

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1216100688 (LWP 20861)]
0xb7a9cc07 in mysql_more_results () from /usr/lib/mysql/libmysqlclient.so.15
(gdb) bt
#0  0xb7a9cc07 in mysql_more_results () from /usr/lib/mysql/libmysqlclient.so.15
#1  0x0818cdf1 in pdo_row_new ()
#2  0x0818cf6d in pdo_dbstmt_free_storage ()
#3  0x082ddef2 in zend_objects_store_free_object_storage ()
#4  0x082b6cd9 in shutdown_executor ()
#5  0x082c2671 in zend_deactivate ()
#6  0x082809d4 in php_request_shutdown ()
#7  0x08344908 in main ()


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-28 17:11 UTC] tony2001@php.net
Fixed in 5_2 and HEAD.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 14:01:35 2025 UTC