Skip to content

Created stubs for the OCI8 extension. #5701

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

Closed
wants to merge 11 commits into from
Closed

Created stubs for the OCI8 extension. #5701

wants to merge 11 commits into from

Conversation

jensdenies
Copy link
Contributor

Hi,

I noticed the OCI8 extension didn't have stubs yet, that's why i decided to try to add them. I went over the implementation of the functions and methods to determine the types, but it would be nice if someone could double check them.

I've ran the tests and about 78% passed, the ones that failed didn't seem to be related to my changes. I could be wrong, however, so it would be nice if someone could check whether the functions and classes still work as expected.

If i recall correctly, someone mentioned the addition of the "false" return type. Did the "false" return type make it into PHP8? If so, should i add return types for the functions which return false and something else?

Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice (and courageous) work! :) I only have a cursory look yet, so I'll continue later.

@kocsismate
Copy link
Member

@jensdenies Yes, false is a valid union type (together with at least one more type). For more information, have a look at https://wiki.php.net/rfc/union_types_v2

I believe not many people can run these tests so it would be appreciated if you could share some of the failing ones. These are not even run in CI.

@jensdenies
Copy link
Contributor Author

@kocsismate Thanks for the kind words and your review. I've processed some of your feedback and replied to some of your comments.

Some failing tests include:

ext/oci8/tests/old_oci_close1.phpt (fatal TypeError instead of expected warning).
ext/oci8/tests/define1.phpt (fatal TypeError instead of expected warning).
ext/oci8/tests/bug42496_1.phpt ( ** ERROR: process timed out **)
ext/oci8/tests/array_bind_float.phpt (expected: 2.5658, actual: 2.5658000000000003)

These are just a few.

Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another batch of comments :)

@jensdenies jensdenies marked this pull request as draft June 16, 2020 22:28
@jensdenies
Copy link
Contributor Author

jensdenies commented Jun 16, 2020

@kocsismate I've fixed the things you requested. I also updated the oci8_statement.c file to use Z_PARAM_STR_OR_LONG, could you please have a look to check whether it is okay?

I have converted this to a draft PR because i did not run the tests with the newest changes yet.

@jensdenies jensdenies requested a review from kocsismate June 16, 2020 22:33
@jensdenies jensdenies marked this pull request as ready for review June 17, 2020 07:05
Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the penultimate review batch :)

@jensdenies
Copy link
Contributor Author

Thanks @kocsismate, i committed the fixes.

Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My part is done with the review. If the current issues get fixed, we can hand it over to @nikic :)

@jensdenies
Copy link
Contributor Author

Thanks again @kocsismate. I committed the last fixes @nikic.

@jensdenies jensdenies requested a review from nikic June 22, 2020 19:57
Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check this in detail, but looks sensible :)

Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a couple of smaller issues


function oci_lob_is_equal(OCI_Lob $lob_descriptor_first, OCI_Lob $lob_descriptor_second): bool {}

function oci_lob_export(OCI_Lob $lob_descriptor, $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the string type of the $path parameter is missing

* @alias oci_lob_export
* @deprecated
*/
function ociwritelobtofile(OCI_Lob $lob_descriptor, $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before

@jensdenies
Copy link
Contributor Author

@kocsismate Fixed, thanks.

@jensdenies jensdenies requested a review from kocsismate June 24, 2020 21:14
Copy link
Member

@kocsismate kocsismate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a last full round of review, I found a few minor issues. When fixing them, please rebase your branch to current master (so that the stub file will have a hash + your ZPP fixes are there), and run the tests. If they pass, then I'll merge the PR :)

@jensdenies
Copy link
Contributor Author

@kocsismate Hi, i applied the requested changes and i think i've rebased master. Did i do it correct? I've ran the tests and not all of them pass, but i dont think it's related to my changes,.

@kocsismate
Copy link
Member

kocsismate commented Jul 3, 2020

@jensdenies The fixes look good! However, I don't think you rebased to current master, because there should be a hash in the beginning of the arginfo file now. That possibly means you have to fetch current master from the upstream remote:

git pull upstream master --rebase

P.S. You don't need --rebase if you have configured git to use rebase by default

If you haven't done that before, you can set up the upstream remote like below:

git remote add upstream [email protected]:php/php-src.git

@jensdenies
Copy link
Contributor Author

Thanks @kocsismate, i think it worked. There's a hash in the file now.

@php-pulls php-pulls closed this in 58f51f8 Jul 4, 2020
@kocsismate
Copy link
Member

@jensdenies I've just merged your work! Congrats! As a follow-up, the oci_internal_debug() method should be removed. You can also try to fix the UNKNOWN defaults, if you're up to a new challenge. ^^

@jensdenies
Copy link
Contributor Author

Thanks @kocsismate for all your help! I noticed the oci_interna_debug function and emailed @cjbj about it. So i will make a new PR to remove that function, i’ll also make a PR to deprecate ocifetchinto, since i forgot it while deprecating the other aliases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants