From:             christian dot mueller at dfpx dot de
Operating system: WinXp Pro
PHP version:      5CVS-2005-08-24 (snap)
PHP Bug Type:     PDO related
Bug description:  Can't override execute(), can't call own Methods

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 bug report at http://bugs.php.net/?id=34235&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34235&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34235&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34235&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34235&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34235&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34235&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34235&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34235&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34235&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34235&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34235&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34235&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34235&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34235&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34235&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34235&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34235&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34235&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34235&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34235&r=mysqlcfg

Reply via email to