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 (profile)
Status: Closed Package: PDO related
PHP Version: 5CVS-2005-09-21 (CVS) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php dot net at benjamin dot schulz dot name
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 12:01:28 2024 UTC