#38166 [Opn->Fbk]: Calling PDO::prepare or PDO::query then calling non-existent method crashes PHP
ID: 38166
Updated by: tony2001@php.net
Reported By: jerome at macsaresexy dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Ubuntu Linux
PHP Version: 5.1.4
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Can't reproduce.
Previous Comments:
------------------------------------------------------------------------
[2006-07-20 17:41:39] jerome at macsaresexy dot com
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 this bug report at http://bugs.php.net/?id=38166&edit=1
Thread (4 messages)