#34235 [Opn->Bgs]: Can't override execute(), can't call own Methods
| From: | sniper@php.net | Date: | Wed, 24 Aug 2005 14:15:16 +0000 |
| Subject: | #34235 [Opn->Bgs]: Can't override execute(), can't call own Methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83945@lists.php.net to get a copy of this message | ||
ID: 34235
Updated by: sniper@php.net
Reported By: christian dot mueller at dfpx dot de
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: WinXp Pro
PHP Version: 5CVS-2005-08-24 (snap)
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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