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

Fix PDO OCI Bug #60994 (Reading a multibyte CLOB caps at 8192 chars) #8018

Closed
wants to merge 1 commit into from

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Feb 1, 2022

based on GH-5233 (authored by Randy Stark)

/cc original authors @gschc1, @cjbj, @cmb69

@mvorisek mvorisek marked this pull request as ready for review February 1, 2022 11:42
@cmb69
Copy link
Member

cmb69 commented Feb 24, 2022

@cjbj, could you please review?

@cjbj
Copy link
Contributor

cjbj commented Feb 24, 2022

@cmb69 I pinged our developer about it yesterday.

@mvorisek
Copy link
Contributor Author

mvorisek commented Mar 12, 2022

I have tested this PR in our CI and I can confirm it works. Can it be merged?

Test results:

@mvorisek
Copy link
Contributor Author

I pinged our developer about it yesterday.

@cjbj can you please ping someone from your team again to review this PR?

@cjbj
Copy link
Contributor

cjbj commented Mar 15, 2022

Pinged.

@mvorisek
Copy link
Contributor Author

@cmb69 do you think someone else can review & merge this PR?

This bugfix PR is here for more than 50 days and the original #5233 for more than 2 years.

It also have a test and I have also tested it by myself in a real app.

Thank you in advance.

@cjbj
Copy link
Contributor

cjbj commented Mar 21, 2022

It's not a matter of reviewing it; it's a matter of working out why some diffs are occurring.

@mvorisek
Copy link
Contributor Author

@cjbj thank you for your comment, what do you mean by

some diffs are occurring

I belive the only issue is that the deprecated [1] OCILobRead function is used instead the newer OCILobRead2 which does support Unicode multibyte strings correctly.

[1] https://docs.oracle.com/cd/E11882_01/appdev.112/e10646/ociaedep003.htm#LNOCI17212

@mvorisek
Copy link
Contributor Author

mvorisek commented Mar 24, 2022

image

the only issue with the original code is the line

self->offset += amt;
where the offset is saved

the diff above shows dumped variables with the same data from the original and the new code

The offset is in characters, but everything else is in bytes.

@cjbj is there any way how length in characters can be obtained from buffer data and bytes length? If yes, please advise, if not, I belive the code /wo OCILobRead2 (available since Oracle 10g, released in 2003) cannot be fixed.

@mvorisek mvorisek force-pushed the fix-60994-oracle branch 4 times, most recently from 7f09b51 to e1ef164 Compare March 25, 2022 10:36
@mvorisek
Copy link
Contributor Author

@cmb69 can you please review with the discussion above?

@cjbj
Copy link
Contributor

cjbj commented Mar 31, 2022

@mvorisek my developer is happy but is seeing a diff on the first test of single byte characters where the expected number of bytes seems out of whack.

@mvorisek
Copy link
Contributor Author

@cjbj thank you for the feedback, can you please provide more details and advise possible fix?

@cjbj
Copy link
Contributor

cjbj commented Apr 12, 2022

I believe an xfail can be removed and the size fixed. I was pointed at the updated file but it is on a system I can't access so I'm still waiting. The PR can be merged and the test fixed later.

@cjbj
Copy link
Contributor

cjbj commented Apr 12, 2022

Via magic:

---XFAIL--
-Fails due to Bug 60994
 --EXPECT--
 Test 1:  j
-size of string1 is 1000006 bytes, 1000006 chars.
-size of stream1 is 1000006 bytes, 1000006 chars.
+size of string1 is 8193 bytes, 8193 chars.
+size of stream1 is 8193 bytes, 8193 chars.
 beg  of stream1 is abcjjjjjjj
 end  of stream1 is jjjjjjjxyz

@mvorisek
Copy link
Contributor Author

mvorisek commented May 26, 2022

I tested this PR with #8348, the pdo_oci tests are passing incl. ext/pdo_oci/tests/bug60994.phpt, can this PR be merged?

when merging, please mention also the original author of #5233 in the NEWS and also close that PR

@cjbj
Copy link
Contributor

cjbj commented Jun 2, 2022

@mvorisek I have prodded development. My own time with code is limited these days :(

@mvorisek
Copy link
Contributor Author

Thank to the CI, we can be safe now about the PR. Previsouly, the test /w 1000006 bytes was definitely wrong/xfail.

If there is no feedback to address, please merge into PHP 8.0/bugfix.

@mvorisek
Copy link
Contributor Author

mvorisek commented Sep 1, 2022

@cmb69 would it be possible to merge this PR?

@mvorisek
Copy link
Contributor Author

@cmb69 @kocsismate can you please review this PR and merge it?

@cmb69
Copy link
Member

cmb69 commented Sep 16, 2022

I can't really comment on oci issues, but this fix seems to be okay. However, I wouldn't want to merge that into any of the stable branches (targeting PHP-8.2 should still be okay), especially since this is a long standing issue (it has been reported more than ten years ago).

So this should better be decided by the respective RMs. @sgolemon, @carusogabriel, thoughts?

And maybe @ashnazg wants to have a look, since he commented on the bug report (albeit long ago).

@mvorisek
Copy link
Contributor Author

About the targetting: this PR fixes a major PDO OCI issue - larger than 8KiB BLOBs /w multibyte UTF-8 text cannot be currently read which almost impossible to overcome from the user perspective. I still belive this PR should target PHP 8.0. We have CI tests and it definitely fits the category bugfix.

@carusogabriel
Copy link
Contributor

I will give @sgolemon the final word, but if I can drop my 2 cents:

I don't see any problems merging into PHP 8.0 - it's an isolated part of PHP, and if we have regressions - albeit the tests we have in place - it shouldn't be a catastrophe. I can't, though, access the impact - hence asking Sara's input.

@cmb69
Copy link
Member

cmb69 commented Sep 20, 2022

We have CI tests

Which only test one of the code paths (HAVE_OCILOBREAD2), to my knowledge.

@mvorisek
Copy link
Contributor Author

@sgolemon any chance you can approve this bugfix?

@cjbj cjbj self-requested a review September 28, 2022 05:37
@mvorisek mvorisek changed the base branch from PHP-8.0 to PHP-8.1 November 12, 2022 14:07
@ashnazg
Copy link
Contributor

ashnazg commented Nov 12, 2022

+1 from me... if it's making my PHPT pass, then I'm good.

@mvorisek
Copy link
Contributor Author

mvorisek commented Jan 9, 2023

This PR has been here for a while. Initially it target PHP 8.0, it was reviewed by @cjbj and @cmb69 and release manager @carusogabriel has given it a green light. During this time PHP 8.0 development was closed, so I rebased/retargetted the PR into PHP 8.1. Now, I would kindly ask if there is anything I need to address or of this PR can be merged. Thank you.

@carusogabriel
Copy link
Contributor

@mvorisek RMs from PHP 8.1 should review this now.

@mvorisek
Copy link
Contributor Author

mvorisek commented Feb 3, 2023

Hi @krakjoe, @ramsey, @patrickallaert, pinging you as you are RM for PHP 8.1.

@ramsey
Copy link
Member

ramsey commented Feb 3, 2023

If @cjbj and @cmb69 have given it the green light, then I see no reason not to merge this into 8.1.

@cjbj
Copy link
Contributor

cjbj commented Feb 7, 2023

LGTM

@ramsey
Copy link
Member

ramsey commented Feb 7, 2023

Committed in 4df4264

@ramsey ramsey closed this Feb 7, 2023
@mvorisek mvorisek deleted the fix-60994-oracle branch February 7, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants