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

Do not set code when recasting PDOException #2101

Merged
merged 1 commit into from
Jul 15, 2022
Merged

Conversation

MasterOdin
Copy link
Member

@MasterOdin MasterOdin commented Jul 8, 2022

Fixes #2098

The PDOException class has the signature int|string $code, which makes it incompatible with most other stdlib exceptions that only allow int $code. While we could probably make a custom exception class or whatever for the recast, I don't think it's worth the hassle, and looking at the DB ecosystem, some amount of it also just drops the code in favor of just using 0 (e.g. cakephp/Database in Database/Driver and have for years that I'm not sure people will really miss it.

The PDOException recast has been happening for the entire existence of this project that I'm somewhat risk adverse to remove the recast.

@MasterOdin MasterOdin requested a review from dereuromark July 8, 2022 21:58
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
@MasterOdin MasterOdin changed the base branch from 0.x to 0.next July 8, 2022 22:13
@MasterOdin
Copy link
Member Author

Having this target 0.next as it is a breaking change assuming there's someone out there relying on what the recast exception code is for doing something.

@MasterOdin MasterOdin merged commit 9ba5deb into 0.next Jul 15, 2022
@MasterOdin MasterOdin deleted the bugfix_pdo_code branch July 15, 2022 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.1 : Type issue when PDOException is thrown
1 participant