#37678 [NEW]: Segfault when calling exit or die after creating a PDO stmt object
| From: | courier at ipwar dot ch | Date: | Fri, 02 Jun 2006 13:50:20 +0000 |
| Subject: | #37678 [NEW]: Segfault when calling exit or die after creating a PDO stmt object | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-97978@lists.php.net to get a copy of this message | ||
From: courier at ipwar dot ch
Operating system: Gentoo Linux
PHP version: 5.1.4
PHP Bug Type: PDO related
Bug description: Segfault when calling exit or die after creating a PDO stmt object
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 $
--
Edit bug report at http://bugs.php.net/?id=37678&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37678&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37678&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37678&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37678&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37678&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37678&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37678&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37678&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37678&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37678&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37678&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37678&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37678&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37678&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37678&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37678&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37678&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37678&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37678&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37678&r=mysqlcfg