-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix bug GH-7746 (mysqli_sql_exception->sqlstate is inaccessible) #7747
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
Like I just commented on 7746, PHP's own exceptions typically use private/protected variables and provide getter methods instead. This way the exception can be immutable. |
I can write a getter method for this, but I would need help. How do I read a property? Is there a helper macro for this? |
You have to use |
593540f
to
d9529fb
Compare
Regarding the name of the accompanying regression test (bugGH7746.phpt): I'm fine with this naming convention. Should we document that on http://qa.php.net/write-test.php#naming-conventions? |
I'd target this at PHP-8.1, don't think adding a new method this late in the 8.0 release cycle is a good idea in terms of version constraints.
I'd go for either just |
I suggested the former but @Danack made a good point that having "bug" in the filename makes it more explicit that it's a regression test. I have no strong opinion either way. |
9b7d80c
to
4c4ce97
Compare
Create getter instead of making the property public
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.
Thank you! This looks good to me.
Fixes #7746
The property should not have been protected ever. It was meant to be public.