Repository navigation
Conversation
iliaal
approved these changes
Nov 8, 2026
devnexen
requested changes
Nov 9, 2026
| @@ -3117,7 +3117,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP | |||
| } else { | |||
Member
There was a problem hiding this comment.
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -3080,6 +3080,17 @@ static zval* to_zval_list(zval *ret, encodeTypePtr enc, xmlNodePtr data) {
return to_zval_stringc(ret, enc, data);
}
+static void to_xml_list_item_error(encodeTypePtr enc, encodePtr list_enc)
+{
+ if (enc->sdl_type && enc->sdl_type->kind == XSD_TYPEKIND_UNION) {
+ soap_error1(E_ERROR, "Encoding: Value does not match any member type of union type '%s'",
+ soap_type_name(enc));
+ } else {
+ soap_error2(E_ERROR, "Encoding: Failed to encode list item of type '%s' for list type '%s'",
+ soap_type_name(list_enc ? &list_enc->details : NULL), soap_type_name(enc));
+ }
+}
+
static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodePtr parent) {
xmlNodePtr ret;
encodePtr list_enc = NULL;
@@ -3115,9 +3126,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
}
smart_str_appends(&list, (char*)dummy->children->content);
} else {
- soap_error2(E_ERROR,
- "Encoding: Failed to encode list item of type '%s' for list type '%s'",
- soap_type_name(&list_enc->details), soap_type_name(enc));
+ to_xml_list_item_error(enc, list_enc);
}
xmlUnlinkNode(dummy);
xmlFreeNode(dummy);
@@ -3159,9 +3168,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
}
smart_str_appends(&list, (char*)dummy->children->content);
} else {
- soap_error2(E_ERROR,
- "Encoding: Failed to encode st type '%s'",
- soap_type_name(&list_enc->details), soap_type_name(enc));
+ to_xml_list_item_error(enc, list_enc
}
xmlUnlinkNode(dummy);
xmlFreeNode(dummy);
Contributor
Author
|
Applied your suggestion in 96183be, the union case now gets its own message and the test expects it. |
devnexen
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A union type (and a list without an item type) leaves
list_encNULL into_xml_list(). When an item fails to encode, the new error message from #22706 readslist_enc->detailsand dereferences NULL. It now passes NULL tosoap_type_name()in that case, which already prints "unknown".Fixes #25303