#34590 [NEW]: User defined PDOStatement class can't implement methods
| From: | php dot net at benjamin dot schulz dot name | Date: | Wed, 21 Sep 2005 20:15:05 +0000 |
| Subject: | #34590 [NEW]: User defined PDOStatement class can't implement methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-85385@lists.php.net to get a copy of this message | ||
From: php dot net at benjamin dot schulz dot name
Operating system: linux
PHP version: 4CVS-2005-09-21 (CVS)
PHP Bug Type: PDO related
Bug description: User defined PDOStatement class can't implement methods
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:
---------------
<?php
$pdo = new PDO("pgsql:user=zrm dbname=zrm host=localhost");
class myStatement extends PDOStatement
{
function foo()
{
echo __METHOD__;
}
}
$opts = array();
$opts[PDO::ATTR_STATEMENT_CLASS] = array('myStatement');
$r = $pdo->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 bug report at http://bugs.php.net/?id=34590&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34590&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34590&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34590&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34590&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34590&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34590&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34590&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34590&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34590&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34590&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34590&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34590&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34590&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34590&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34590&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34590&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34590&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34590&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34590&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34590&r=mysqlcfg