#34590 [Opn]: User defined PDOStatement class can't implement methods
| From: | php dot net at benjamin dot schulz dot name | Date: | Wed, 21 Sep 2005 20:16:59 +0000 |
| Subject: | #34590 [Opn]: User defined PDOStatement class can't implement methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85386@lists.php.net to get a copy of this message | ||
ID: 34590
User updated by: php dot net at benjamin dot schulz dot name
Reported By: php dot net at benjamin dot schulz dot name
Status: Open
Bug Type: PDO related
Operating System: linux
-PHP Version: 4CVS-2005-09-21 (CVS)
+PHP Version: 5CVS-2005-09-21 (CVS)
New Comment:
adjusted the php version
Previous Comments:
------------------------------------------------------------------------
[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:
---------------
<?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 this bug report at http://bugs.php.net/?id=34590&edit=1