-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[Bug #77120] Handle OCI_SUCCESS_WITH_INFO returned from OCISessionBegin #6857
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
cc @cjbj |
I'd like to review it first. |
@morozov Is it possible to provide a test with this? |
Absolutely. I just want to make sure the fix as such is acceptable. |
Adding a test now would expedite me reviewing it. Otherwise I have to create the test... :) |
I can add a test by Monday. |
@morozov Thank you. I should get time later this week to take a look. |
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.
Can you also check some other SUCCESS_WITH_INFO cases such as PL/SQL compilation failures? Check them for various PDO::ATTR_ERRMODE values. (And verify the old & new behaviors). Thank you!
What would be the best way to reproduce this? I tried a couple of examples I found online (e.g. this) in PhpStorm but it didn't trigger the expected error. |
1. Proceed with connection initialization if OCI_SUCCESS_WITH_INFO is returned 2. Do not throw an exception upon OCI_SUCCESS_WITH_INFO
I manages to reproduce the compilation error with the following: function triggerCompilationError(PDO $conn): void {
$conn->exec(<<<'SQL'
CREATE OR REPLACE FUNCTION BUG77120(INT A) RETURN INT
AS
BEGIN
RETURN 0;
END;
SQL
);
}
triggerCompilationError($conn);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
triggerCompilationError($conn); Which produces the following:
I assume the error handling still exists in this scenario but it's out of the scope of the original issue. Statement error handling can be configured at runtime while connection error handling cannot. |
The PR changes You could use |
It wasn't borked, it worked as previously, see #6857 (comment). Please see the update. I modified handling |
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.
Thanks for tidying up, and for adding the extra checks to confirm the behavior.
With the trivial test changes I noted, let's get this merged.
Thanks for making PDO_OCI better.
1. Backup last_error before replacing it with the error code 2. Continue normal operations if last_error is OCI_SUCCESS_WITH_INFO
@cjbj thanks for the review. Please see the update. |
@cjbj any chance you could review this again? |
LGTM @ramsey can you advise on the (new) current process for merging? |
@ramsey what would be the next step to get this patch accepted? |
All good. Sorry for the delay. Thanks! |
This should have an entry in NEWS. |
Done. Thanks all. |
Thanks, @cjbj! |
Create a test user:
Run the script:
Expected result:
The connection is successfully established. The details of the informational message are available via
PDO::errorInfo()
.Actual result:
Change summary:
OCI_SUCCESS_WITH_INFO
is returned.OCI_SUCCESS_WITH_INFO
.