Skip to content

Fix __call in PDO subclass breaking method calls #9102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

iluuu1994
Copy link
Member

Fixes GH-7803

Are changes like these acceptable after the feature freeze? The issue is marked as a feature, but that's mostly so that we don't back-port the fix and change longstanding behavior.

@Girgias
Copy link
Member

Girgias commented Jul 22, 2022

Win test failure seems to be related but is quite odd:

Environment: THREAD_SAFE=0, OPCACHE=0, PARALLEL=-j2
========DIFF========
001+ Fatal error: Uncaught PDOException: could not find driver in C:\projects\php-src\ext\pdo_sqlite\tests\gh7803.php:11
002+ Stack trace:
003+ #0 C:\projects\php-src\ext\pdo_sqlite\tests\gh7803.php(11): PDO->__construct('sqlite::memory:', '', Object(SensitiveParameterValue), Array)
004+ #1 {main}
005+   thrown in C:\projects\php-src\ext\pdo_sqlite\tests\gh7803.php on line 11
001- __call: nonexistent
002- array(2) {
003-   ["CONCAT('123', '456', '789')"]=>
004-   string(9) "123456789"
005-   [0]=>
006-   string(9) "123456789"
007- }
========DONE========
FAIL GH-7803: PDO __call breaks method calls [C:\projects\php-src\ext\pdo_sqlite\tests\gh7803.phpt]

Otherwise I think it is fine to merge this after feature freeze as this is self contained and more a bug fix than anything else IMHO

@@ -0,0 +1,36 @@
--TEST--
GH-7803: PDO __call breaks method calls
--FILE--
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to explicitly declare the required extensions (pdo_sqlite is not loaded on AppVeyor by default):

Suggested change
--FILE--
--EXTENSIONS--
pdo_sqlite
--FILE--

@cmb69
Copy link
Member

cmb69 commented Jul 23, 2022

I'm not quite sure if we should fix this in this way. I'd very much prefer a more general solution like https://wiki.php.net/rfc/pdo_driver_specific_subclasses, but of course, it is not clear that we will have something like this in the foreseeable future. :(

@iluuu1994
Copy link
Member Author

@cmb69 I didn't know about this RFC, I agree that solution would be preferable. I'll close this for now and reopen in case the RFC would fail.

@iluuu1994 iluuu1994 closed this Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extends PDO, sqliteCreateFunction() and magic method __call()
3 participants