php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44167 Is PDO::getAvailableDrivers() really static?
Submitted: 2008-02-19 13:10 UTC Modified: 2008-02-19 13:24 UTC
From: uwendel at mysql dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.3CVS-2008-02-19 (CVS) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: uwendel at mysql dot com
New email:
PHP Version: OS:

 

 [2008-02-19 13:10 UTC] uwendel at mysql dot com
Description:
------------
According to the manual, the PDO method getAvailableDrivers() is static:

"This function returns all currently available PDO drivers which can be used in DSN  parameter of PDO->__construct(). This is a static method.",
http://de.php.net/manual/en/function.PDO-getAvailableDrivers.php

That's not true. You can invoke it using static and non-static syntax. I'd call it a feature not a bug. In any case it should be documented.

Reproduce code:
---------------

nixnutz@ulflinux:~/php53> sapi/cli/php -r '$pdo=new PDO("sqlite:/tmp/foo.db"); var_dump($pdo->getAvailableDrivers()); var_dump(PDO::getAvailableDrivers());'
array(4) {
  [0]=>
  string(7) "sqlite2"
  [1]=>
  string(6) "sqlite"
  [2]=>
  string(5) "pgsql"
  [3]=>
  string(5) "mysql"
}
array(4) {
  [0]=>
  string(7) "sqlite2"
  [1]=>
  string(6) "sqlite"
  [2]=>
  string(5) "pgsql"
  [3]=>
  string(5) "mysql"
}



Expected result:
----------------
I'm fine with the implementation, no change. But decide on the question if its a feature or a bug.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-19 13:24 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That's common beahvior of PHP's object model, see also:

class C {
    static function foo() {
        echo "I'm here!";
    }
}

$c = new C();
$c->foo();
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC