#34590 [Asn->Fbk]: User defined PDOStatement class can't implement methods
| From: | helly@php.net | Date: | Wed, 21 Sep 2005 22:25:53 +0000 |
| Subject: | #34590 [Asn->Fbk]: User defined PDOStatement class can't implement methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85408@lists.php.net to get a copy of this message | ||
ID: 34590
Updated by: helly@php.net
Reported By: php dot net at benjamin dot schulz dot name
-Status: Assigned
+Status: Feedback
Bug Type: PDO related
Operating System: linux
PHP Version: 5CVS-2005-09-21 (CVS)
Assigned To: helly
New Comment:
what's the output of:
var_dump($r);
infront of:
var_dump($r->foo());
Previous Comments:
------------------------------------------------------------------------
[2005-09-21 23:13:46] sniper@php.net
Marcus, fix.
------------------------------------------------------------------------
[2005-09-21 22:45:57] christian dot mueller at dfpx dot de
Duplicate of http://bugs.php.net/bug.php?id=34235
But this on has an much tighter reproduce code.
------------------------------------------------------------------------
[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