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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 15:01:30 2025 UTC