php.net |  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
Description:
------------
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:
---------------
<?php
class MyAuthHttp
{
    private $mydb;

    /**
     * Constructor
     */
    public function __construct($adb)
    {
        
        $this->mydb = $adb;
        $this->checkAuthData('heda1','heda1');
    }

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


            die('test');



            //$stmt->bindParam(':user',$user, PDO::PARAM_STR);
            //$stmt->bindParam(':paw', $shpw, PDO::PARAM_STR);
            $stmt->execute();
            $res = $stmt->fetchAll(PDO::FETCH_ASSOC);
            // do somephing with the result ,,,
            return false;
        }
        catch (Exception $e)
        {
            debug_print_backtrace();
            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
test
nerve@powerstation ~/semarbeit $     

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-02 13:59 UTC] pajoye@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:28 2024 UTC