-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/soap: setting xml namespace in classmap #12411
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
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 your PR.
I have some remarks for changes to the code that'll simplify this a bit and improve performance.
f116186
to
3bc3728
Compare
Thanks! 🙏 |
Thanks for the changes, looks pretty good. One thing I wonder about the classmap is this; if we have: |
maybe change the order?
|
Perhaps changed order. I get that you want to avoid the additional lookup. Makes me think that the zend_string construction could be cached maybe too. |
ext/soap/php_encoding.c
Outdated
classname = zend_hash_str_find_deref(SOAP_GLOBAL(class_map), type->type_str, strlen(type->type_str)); | ||
if(classname == NULL){ | ||
if (type->ns) { | ||
zend_string *nscat =zend_strpprintf(0, "{%s}%s", type->ns, type->type_str); | ||
classname = zend_hash_find_deref(SOAP_GLOBAL(class_map),nscat); |
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.
- I think it's better to change the order (first search in namespace).
- Usage of
zend_strpprintf()
on each lookup looks inefficient (additional memory allocation/deallocation). It would be great to find a better solution.
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.
In general this looks good.
I have only minor comments, and I don't see a simple decision to get rid from zend_strprintf()
. So I wouldn't object about committing the patch in the current state.
@nielsdos please take care about finalizing and landing this.
@lxShaDoWxl Let's change the check order. Also, an idea to avoid constantly allocating temporary strings:
If you're unsure how to do it, I can take it from here if you want :) |
@nielsdos please do it 🙏 I didn't understand everything myself how to do it😅 |
Okay no worries, I'll have a look later this week to finish this. |
@nielsdos I did it a little differently, please take a look lxShaDoWxl@bbbb545 |
@lxShaDoWxl that looks pretty good, thank you! I left some comments, after addressing those feel free to add it to this PR. |
@nielsdos I added the
|
@lxShaDoWxl I've pushed the fix for your issue to your branch. The code you posted for MSHUTDOWN should now work. |
@nielsdos Thanks! I added my code to |
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.
I merged this manually as I had to rebase onto master, and I performed some small style tweaks and added a note to NEWS and UPGRADING.
Thank you very much for your contribution! Good work.
Merged as e58af7c
It seems some of the last soap patches broke something. See https://github.com/php/php-src/actions/runs/6621079042/job/17984591267 @nielsdos please take care |
Ok I will be able to check tonight. |
Fixed here: #12514 |
Added support setting namespace in classmap. For multiple namespace and not unique name type