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

When using PDO to connect to the database, a failed connection might trigger a PDOException #17670

Merged
merged 1 commit into from Jun 14, 2021

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jun 14, 2021

Description:

When using PDO to connect to the database, a failed connection might trigger a PDOException. Other than the base exception class, the getCode() of PDO exception returns a string (like HY000). As the php exception class (and DbException, which directly extends php's Exception), requires the code to be an integer, we can't simply use the return value.

fixes L3-109

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review labels Jun 14, 2021
@sgiehl sgiehl added this to the 4.4.0 milestone Jun 14, 2021
@diosmosis diosmosis merged commit 078909e into 4.x-dev Jun 14, 2021
@diosmosis diosmosis deleted the l3-109 branch June 14, 2021 22:14
@mattab mattab changed the title Ensure DbException is thrown correctly When using PDO to connect to the database, a failed connection might trigger a PDOException Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants