Bug #78095 [NEW]: get_class_methods() does not show all methods of a specific PDO driver
| From: | celsowm at gmail dot com | Date: | Sat, 01 Jun 2019 18:08:21 +0000 |
| Subject: | Bug #78095 [NEW]: get_class_methods() does not show all methods of a specific PDO driver | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221076@lists.php.net to get a copy of this message | ||
From: celsowm at gmail dot com
Operating system: Windows
PHP version: 7.3.6
Package: PDO related
Bug Type: Bug
Bug description:get_class_methods() does not show all methods of a specific PDO driver
Description:
------------
I was trying to get all method for each PDO driver (I have all of them
installed on my PC Windows).
But if I try, for example, using Postgres (pdo_pgsql):
var_dump(get_class_methods($pdo));
The result is:
array(17) { [0]=> string(11) "__construct" [1]=> string(7) "prepare"
[2]=> string(16) "beginTransaction" [3]=> string(6) "commit" [4]=>
string(8) "rollBack" [5]=> string(13) "inTransaction" [6]=> string(12)
"setAttribute" [7]=> string(4) "exec" [8]=> string(5) "query"
[9]=>
string(12) "lastInsertId" [10]=> string(9) "errorCode" [11]=> string(9)
"errorInfo" [12]=> string(12) "getAttribute" [13]=> string(5)
"quote"
[14]=> string(8) "__wakeup" [15]=> string(7) "__sleep" [16]=>
string(19)
"getAvailableDrivers" }
But this list is incomplete because PDO Postgres includes methods like:
$pdo->pgsqlCopyToArray('my_table');
Test script:
---------------
<?php
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$server = "localhost";
$dsn = "pgsql:host=$server;port=5432;dbname=livraria;";
$user = "postgres";
$senha = "admin";
$pdo = new PDO($dsn, $user, $senha, $options);
var_dump(get_class_methods($pdo));
var_dump(array_column((new ReflectionClass($pdo))->getMethods(),
'name'));
var_dump($pdo->pgsqlCopyToArray('livro'));
--
Edit bug report at https://bugs.php.net/bug.php?id=78095&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78095&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78095&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78095&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78095&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78095&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78095&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78095&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78095&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78095&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78095&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78095&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78095&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78095&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78095&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78095&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78095&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78095&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78095&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78095&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78095&r=mysqlcfg