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

Migrate ext/soap resources to objects #14121

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

kocsismate
Copy link
Member

Part of php/php-tasks#6. Migrates 2 out of 3 resource types in ext/soap to opaque objects.

@nielsdos
Copy link
Member

nielsdos commented May 3, 2024

There's two simple failures due to different object numberings, that should be easy to fix.
Is it also possible to split the commit into 2: one for each resource? That would make reviewing easier.
ext-soap test coverage is so-so given that the extension contains complex interactions, so I'm a bit worried about the complexity of such a transition, but we'll see I guess.

@kocsismate
Copy link
Member Author

There's two simple failures due to different object numberings, that should be easy to fix.

Yes, these are fixed locally. I'll look into the memory leak related failure tomorrow. :)

Is it also possible to split the commit into 2: one for each resource? That would make reviewing easier.

I may try it, sure.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Is it possible to make the change to a generic namespace in the stubs in a separate commit too? As it does make the diff somewhat confusing.

Didn't really have a look at the actual SOAP changes yet as I don't really know how SOAP works

/** @tentative-return-type */
public function __setLocation(?string $location = null): ?string {}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: EOL before EOF

@kocsismate
Copy link
Member Author

Is it possible to make the change to a generic namespace in the stubs in a separate commit too? As it does make the diff somewhat confusing.

@Girgias Please use the "hide whitespace changes" feature to fix it ^^ But anyway, since I'm currently rewriting the history completely, I'll commit this separately.

kocsismate added a commit that referenced this pull request May 6, 2024
These cause test failures when we migrate resources to objects. But anyway, hardcoding the object IDs and the number of properties is hardly ever useful, so it's fine to get rid of them.
Related to #14121
kocsismate added a commit that referenced this pull request May 6, 2024
These cause test failures when we migrate resources to objects. But anyway, hardcoding the object IDs and the number of properties is hardly ever useful, so it's fine to get rid of them.
Related to #14121
@kocsismate kocsismate marked this pull request as ready for review May 6, 2024 07:14
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Looks good, tested it as well, just some questions.

UPGRADING Outdated
@@ -135,6 +135,10 @@ PHP 8.4 UPGRADE NOTES
. Calling simplexml_import_dom() with a non-XML object now throws a TypeError
instead of a ValueError.

- SOAP:
. SoapClient::$httpurl is now a Soap\Url object rather than a resource.
Value checks using is_resource() should be replaced with checks for `null`.
Copy link
Member

Choose a reason for hiding this comment

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

I first didn't understand what this last sentence meant, but I guess you mean that you have to take into account it can be a null value, so you can't pass it to is_resource? However, is_resource will always return false for Soap\Url, so I'm not sure what you mean.

Copy link
Member Author

@kocsismate kocsismate May 6, 2024

Choose a reason for hiding this comment

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

This is the upgrading note template we used in the past for all the other conversions, but I'm happy to change it in the name of clarity ^^ It is intended to mean that when checking whether the property "has a value", then previously one may have used is_resource($client->httpurl), but obviously this won't work anymore, so it should be changed to $client->httpurl !== null. Of course, it's mostly a theoretical problem IMO, since the property is private.

Copy link
Member

Choose a reason for hiding this comment

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

Okay I get it now, thx for explaining.
I think this is unclear indeed, because "value checks" is quite vague. is_resource always checks a value, so writing "value checks using is_resource()" was very weird to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the "value" word, and added an example. I think that's the most clear we can do. I'll merge my changes, but if the note is still unclear, we can amend it separately.

* @strict-properties
* @not-serializable
*/
class Url
Copy link
Member

Choose a reason for hiding this comment

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

Should this be final? Intuitively I'd think so.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I forgot about the final modifier, but it's a good idea!

UPGRADING Outdated
@@ -138,6 +138,8 @@ PHP 8.4 UPGRADE NOTES
- SOAP:
. SoapClient::$httpurl is now a Soap\Url object rather than a resource.
Value checks using is_resource() should be replaced with checks for `null`.
. SoapClient::$sdl is now a Soap\Sdl object rather than a resource.
Value checks using is_resource() should be replaced with checks for `null`.
Copy link
Member

Choose a reason for hiding this comment

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

Same remark as earlier about the last sentence.

* @strict-properties
* @not-serializable
*/
class Sdl
Copy link
Member

Choose a reason for hiding this comment

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

Should this be final?

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.
For wording in UPGRADING, well I'm not sure what's best. I commented on your reply.

Comment on lines 256 to 259
typedef struct {
php_url *url;
zend_object std;
} soap_url_object;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
typedef struct {
php_url *url;
zend_object std;
} soap_url_object;
typedef struct soap_url_object {
php_url *url;
zend_object std;
} soap_url_object;

Can you please add a name to the struct, instead of typedefing an anonymous struct? This makes the output of tools like "pahole" easier to understand. The same remark applies further below and possibly in other files as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, sure!

@kocsismate kocsismate merged commit 60336de into php:master May 7, 2024
1 of 4 checks passed
@kocsismate kocsismate deleted the soap-resource branch May 7, 2024 07:21
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.

None yet

4 participants