php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34590 User defined PDOStatement class can't implement methods
Submitted: 2005-09-21 22:15 UTC Modified: 2005-09-22 01:01 UTC
From: php dot net at benjamin dot schulz dot name Assigned: helly
Status: Closed Package: PDO related
PHP Version: 5CVS-2005-09-21 (CVS) OS: *
Private report: No CVE-ID:
 [2005-09-21 22:15 UTC] 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() 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-21 22:45 UTC] 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-22 01:01 UTC] helly@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Ok fixed now.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 18:01:58 2014 UTC