-
Notifications
You must be signed in to change notification settings - Fork 20
Maintenance: Towards PHP8, by adding more type hints. Align PDO::errorCode() with specification.
#146
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
Conversation
2e09d8c to
25b190e
Compare
seut
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
According to the specification, the function should return either an error code as string type, or null
error code as string, unbelievable 🙄
|
|
||
| - Maintenance: Added more type hints, mitigating lots of deprecation warnings. | ||
|
|
||
| Breaking changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Breaking changes | |
| Breaking Changes |
matriv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
So, I think PHP is correct on this detail. Whether we made a mistake in the past, by defining the error codes within If you think we are up to something here, and the error code handling would need further adjustments, for example by mapping internal CrateDB error codes defined in Footnotes
|
e80a048 to
a91aa3b
Compare
SHOULD BE REMOVED AFTER INTEGRATING GH-146 [1]. [1] crate/crate-pdo#146
CrateDB's error codes are currently somehow aligned with HTTP error codes instead of codes defined by the SQLSTATE. I think CrateDB itself should move on to SQLSTATE eventually for SQL Standard compatibility. |
2343fde to
f03ae60
Compare
As per [1], `PDO::errorCode()` returns an error code as string type, or `null`. The signature is: public PDO::errorCode(): ?string [1] https://www.php.net/manual/en/pdo.errorcode.php
Codecov complained a bit, with corresponding admonitions on GitHub's PR.
|
It took a few more adjustments to satisfy PHP's type checker wrt. PHP7 vs. PHP8 balancing, Codecov's patch coverage rules, and Scrutinizer's quality assessment. It looks like every validation step succeeded now. -- https://scrutinizer-ci.com/g/crate/crate-pdo/inspections/dfe6c8e8-a803-438d-9027-516419fb7ac0 |
SHOULD BE REMOVED AFTER INTEGRATING GH-146 [1]. [1] crate/crate-pdo#146
SHOULD BE REMOVED AFTER INTEGRATING GH-146 [1]. [1] crate/crate-pdo#146
SHOULD BE REMOVED AFTER INTEGRATING GH-146 [1]. [1] crate/crate-pdo#146
About
Running the standalone example programs added with GH-145 revealed lots of deprecation warnings and subsequent type errors.
Details
PDO::errorCode()with official PDO specification 1.According to the specification, the function should return either an error code as string type, or
null. Its signature is:interror codes. This changed now, and has been advertised properly as breaking change. Personally, I don't think it will have too much impact, as most error handling in userspace programs will be handled by exceptions anyway, as far as I could see, and withinCrateConst.php, it looks like onlyERR_INVALID_SQLhad internal references at all. Please advise if you think this flaw should not be fixed, or differently.Footnotes
https://www.php.net/manual/en/pdo.errorcode.php ↩