#34590 [Com]: User defined PDOStatement class can't implement methods
ID: 34590 Comment by: christian dot mueller at dfpx dot de Reported By: php dot net at benjamin dot schulz dot name Status: Open Bug Type: PDO related Operating System: linux PHP Version: 5CVS-2005-09-21 (CVS) New Comment: Duplicate of http://bugs.php.net/bug.php?id=34235 But this on has an much tighter reproduce code. Previous Comments: [2005-09-21 22:16:59] php dot net at benjamin dot schulz dot name adjusted the php version [2005-09-21 22:15:04] php dot net at benjamin dot schulz dot name Description: When using PDO::ATTR_STATEMENT_CLASS the statement object is an object of the user defined class but it's not possible to access it's (non-pdo) methods Reproduce code: --- prepare('SELECT login_id FROM logins', $opts); var_dump($r->foo()); ?> Expected result: myStatement::foo() Actual result: -- Fatal error: Call to undefined method myStatement::foo() -- Edit this bug report at http://bugs.php.net/?id=34590&edit=1
#34235 [Csd->Opn]: Can't override execute(), can't call own Methods
ID: 34235 User updated by: christian dot mueller at dfpx dot de Reported By: christian dot mueller at dfpx dot de -Status: Closed +Status: Open Bug Type: PDO related Operating System: * -PHP Version: 5CVS-2005-08-30 +PHP Version: 5CVS-2005-09-16 (snap) Assigned To: helly New Comment: The code you use does work, ok. But it has nothing to do with the Bug. Please use the "Reproduce code". Previous Comments: [2005-09-21 11:50:59] [EMAIL PROTECTED] Works in php 5.1: php -r 'class T extends PDO{function exec(){var_dump("myexec");}function f(){}}$o=new T("sqlite::memory:");$o->exec();ReflectionClass::export("T");' PDO doesn't support 5.0 atm. [2005-08-24 20:22:46] volka at cs dot tu-berlin dot de method_exists() returning true but the actual call failing is bewildering to say the least --8<---8<--- array('MTFrame_DB_PDOStatement'))); } } $m = new MTFrame_DB_PDO('sqlite:mydb.sq3'); $stmt = $m->prepare("SELECT COUNT(*) FROM sqlite_master WHERE type='table'"); if ( method_exists($stmt, 'foo') ) $stmt->foo(); else echo 'no such method'; ?> -->8--->8--- [2005-08-24 18:13:11] christian dot mueller at dfpx dot de 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. [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: --- 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
#34235 [Bgs->Opn]: Can't override execute(), can't call own Methods
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: --- 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
#34235 [NEW]: Can't override execute(), can't call own Methods
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: --- 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