php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78126 PDO::sqliteCreateFunction is not exposed via reflection
Submitted: 2019-06-07 23:32 UTC Modified: 2021-09-13 14:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: morozov at tut dot by Assigned:
Status: Open Package: PDO SQLite
PHP Version: 7.3.6 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: morozov at tut dot by
New email:
PHP Version: OS:

 

 [2019-06-07 23:32 UTC] morozov at tut dot by
Description:
------------
Despite being available at runtime, PDO::sqliteCreateFunction is not exposed via reflection: neither via the Reflection API, nor via the command line (php --rc).

Test script:
---------------
$conn = new PDO('sqlite::memory:');
var_dump(method_exists($conn, 'sqliteCreateFunction'));

try {
    $re = new ReflectionMethod($conn, 'sqliteCreateFunction');
} catch (ReflectionException $e) {
    echo $e->getMessage(), PHP_EOL;
}



Expected result:
----------------
Method reflection is created

Actual result:
--------------
bool(true)
Method PDO::sqliteCreateFunction() does not exist


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-08 00:46 UTC] morozov at tut dot by
The same is true for other PDO::sqlite*() and PDO::pgsql*() functions.
 [2019-06-16 03:27 UTC] camporter1 at gmail dot com
The issue here as far as I can tell is that driver methods are not defined directly on the PDO class entry. Instead, an object handler is used to get these methods. From what I can tell, reflection seems to rely only on the class entry.

Since I was curious, I opened https://github.com/php/php-src/pull/4271 as an experimental solution.

This still wouldn't solve listing all of the available methods under get_method, and it's clunky.
 [2019-06-16 03:28 UTC] camporter1 at gmail dot com
The following pull request has been associated:

Patch Name: Change ReflectionMethod object construction to support get_method-based methods
On GitHub:  https://github.com/php/php-src/pull/4271
Patch:      https://github.com/php/php-src/pull/4271.patch
 [2021-09-13 14:44 UTC] cmb@php.net
In my opinion, we should not add support for this to reflection,
but rather get rid of the magic methods, one way or another.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 19:01:32 2024 UTC