Skip to content
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

PDO, PHP 8: Uncaught TypeError: method_exists() #840

Closed
f7h opened this issue Jun 3, 2022 · 2 comments
Closed

PDO, PHP 8: Uncaught TypeError: method_exists() #840

f7h opened this issue Jun 3, 2022 · 2 comments
Labels
bug pdo The PHP PDO Driver (Tier 2) PHP8 PHP 8 compatibility issues
Milestone

Comments

@f7h
Copy link

f7h commented Jun 3, 2022

The following code throws a fatal error with PHP 8.0.15:

include_once __DIR__ . '/../adodb.inc.php';

$db = ADOnewConnection('pdo_mysql://user:pass@localhost/northwind');

var_dump($db->param('test'));
Expected:
string(1) "?"

Actual:
Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in drivers/adodb-pdo.inc.php:251

This is also the case for a few other methods in ADODB_pdo.

@dregad dregad added bug pdo The PHP PDO Driver (Tier 2) PHP8 PHP 8 compatibility issues labels Jun 7, 2022
@dregad dregad added this to the v5.22.3 milestone Jun 7, 2022
@dregad
Copy link
Member

dregad commented Jun 7, 2022

@f7h thanks for your bug report.

This is also the case for a few other methods in ADODB_pdo.

Since you appear to have already identified them, it would be great if you could save us some time and provide us with the list.

mnewnham added a commit that referenced this issue Jun 8, 2022
dregad pushed a commit that referenced this issue Jun 8, 2022
@dregad dregad closed this as completed Jun 8, 2022
@f7h
Copy link
Author

f7h commented Jun 8, 2022

It's always the same construct:

if(method_exists($this->_driver, 'some_method')) {

in:

Concat()
param()
metaIndexes()
metaPrimaryKeys()
metaForeignKeys()
metaProcedures()
SetAutoCommit()
SetTransactionMode()
beginTrans()
commitTrans()
RollbackTrans()
createSequence()
DropSequence()
GenID()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pdo The PHP PDO Driver (Tier 2) PHP8 PHP 8 compatibility issues
Projects
None yet
Development

No branches or pull requests

2 participants