Skip to content

Fix #64705 PDO driver constructor throw PDOException but not setting errorInfo #3843

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 5 commits into from

Conversation

ahmedsbytes
Copy link

Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails

Pdo drivers constructors are throwing PdoException wtihout setting errorInfo,
so creating new reusable function that throw exceptions for pdo and will set the errorInfo also,
and using this function with pdo_mysql,pdo_sqlite,pdo_pgsql.

@ahmedsbytes ahmedsbytes changed the title Fix #64705 errorInfo property of PDOException is null in constructor error Fix #64705 PDO driver constructor throw PDOException but not setting errorInfo Feb 17, 2019
…struct() fails

Pdo drivers constructors are throwing PdoException wtihout setting errorInfo,
so creating new reusable function that throw exceptions for pdo and will set the errorInfo also,
and using this function with pdo_mysql,pdo_sqlite,pdo_pgsql.

 Author:    Ahmed Abdou <mail@ahmed.nu>
@krakjoe
Copy link
Member

krakjoe commented Feb 27, 2019

Exporting functions changes ABI, we can't change ABI in released branches.

@nikic
Copy link
Member

nikic commented Feb 27, 2019

@krakjoe Exporting new function is okay, as long as nothing existing changes.

@ahmedsbytes
Copy link
Author

is there suggestion that can help to move this forward ?

@othercorey
Copy link
Contributor

Is there any possibility of this going in for php 8 at least?

@nikic nikic changed the base branch from PHP-7.2 to PHP-7.3 August 11, 2020 14:40
@nikic
Copy link
Member

nikic commented Aug 11, 2020

Merged as 2fe2e5b. An annoying discrepancy is that these PDOExceptions contain the driver error code in ->code, while normally it contains the pdo error code :(

@nikic nikic closed this Aug 11, 2020
@ahmedsbytes ahmedsbytes deleted the patch_bug_64705 branch August 12, 2020 10:19
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.

6 participants