ID: 34235 User updated by: christian dot mueller at dfpx dot de Reported By: christian dot mueller at dfpx dot de -Status: Bogus +Status: Open Bug Type: PDO related Operating System: WinXp Pro PHP Version: 5CVS-2005-08-24 (snap) New Comment:
The manual (or further sources) does not state, that PDOStatement::execute() can't be overridden or that PDO::prepare() returns a somewhat castrated object. var_dump($stmt) identifies $stmt as of MTFrame_DB_PDOStatement, just as in my "reproduce code". But the object lacks method foo(). Better said, the object acts, as if it was a plain PDOStatement. This is no expected, please correct me. Previous Comments: ------------------------------------------------------------------------ [2005-08-24 16:15:14] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ------------------------------------------------------------------------ [2005-08-24 15:59:14] christian dot mueller at dfpx dot de Description: ------------ When i try to override PDO_Statement::execute(), my Method is ignored completly. When i try to implement ::foo() in my extending class, PHP states it is undefined. Reproduce code: --------------- <?php class MTFrame_DB_PDOStatement extends PDOStatement { public function execute() { throw new Exception(); // Nothing happens, i'm ignored } public function foo() { throw new Exception(); // i do not exist? } } class MTFrame_DB_PDO extends PDO { function prepare($sql) { return parent::prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('MTFrame_DB_PDOStatement'))); } function query($sql) { $stmt = parent::prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('MTFrame_DB_PDOStatement'))); $stmt->foo(); return $stmt; } } ?> Actual result: -------------- MTFrame_DB_PDOStatement::execute() gets ignored. calling ::foo() produces: Call to undefined method MTFrame_DB_PDOStatement::foo() ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34235&edit=1
