From: jerome at macsaresexy dot com
Operating system: Ubuntu Linux
PHP version: 5.1.4
PHP Bug Type: PDO related
Bug description: Calling PDO::prepare or PDO::query then calling non-existent
method crashes PHP
Description:
------------
PHP crashes with a seg fault if you try to call a method that
doesn't exist, on any particular object, after a call from
PDO::prepare() or PDO::query().
Reproduce code:
---------------
class TestClass {
static $db;
function test() {
$stmt = self::$db->prepare('SELECT * FROM users');
$this->omg();
}
}
TestClass::$db = new PDO('mysql:host=localhost;dbname=mydb','root','');
$test = new TestClass();
$test->test();
Expected result:
----------------
Should produce a call to undefined method TestClass::omg()
fatal error message.
Actual result:
--------------
What I get instead is a segmentation fault of the child apache
process seen in the error_log file. This only happens when
$db->prepare() is assigned to a variable too, if $stmt = isn't
there, it won't crash.
--
Edit bug report at http://bugs.php.net/?id=38166&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38166&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38166&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38166&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38166&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38166&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38166&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38166&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38166&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38166&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38166&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38166&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38166&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38166&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38166&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38166&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38166&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38166&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38166&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38166&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38166&r=mysqlcfg