|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37678 Segfault when calling exit or die after creating a PDO stmt object
Submitted: 2006-06-02 13:50 UTC Modified: 2006-06-02 13:59 UTC
From: courier at ipwar dot ch Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.4 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2006-06-02 13:50 UTC] courier at ipwar dot ch
php (as cli or as apache2 module) 
generate a Segmentation fault
if a pdo statement is created and after that,
in the script called exit() or die() but the statemnt was never executed !!!

An other segfault is when a class extends an other,
create a pdo statement object, and call a function of
witch the object has no right (e.g. private not protected).

No error is shown on the apache website, instead the connection is reseted, only on the console it says the problem and segfaulting.

Reproduce code:
class MyAuthHttp
    private $mydb;

     * Constructor
    public function __construct($adb)
        $this->mydb = $adb;

    private function checkAuthData($user, $password)
        try {
            $shpw = sha1($password);
            $stmt = $this->mydb->prepare("SELECT *, ( select id as did from Dozent d where = ) as dozentid, ( select id as sid from Student s where = ) as studentid  FROM Person p where loginName = 'heda1' and passwordDigestSHA1x = '". $shpw . "'");


            //$stmt->bindParam(':user',$user, PDO::PARAM_STR);
            //$stmt->bindParam(':paw', $shpw, PDO::PARAM_STR);
            $res = $stmt->fetchAll(PDO::FETCH_ASSOC);
            // do somephing with the result ,,,
            return false;
        catch (Exception $e)
            die("<br>\nFehler: ".__FILE__." : ".__LINE__." :<br>\n".$e->getMessage()."<br>\n");
            return false;

$auth = new MyAuthHTTP(new PDO('mysql:host=localhost;dbname=dbname', 'user', 'pw'));


Expected result:
nerve@powerstation ~/semarbeit $ php test.php
testSegmentation fault
nerve@powerstation ~/semarbeit $     

Actual result:
nerve@powerstation ~/semarbeit $ php test.php
nerve@powerstation ~/semarbeit $     


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-02 13:59 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

duplicate of #37445
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC