Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,29 +1134,27 @@ static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNo

static zval *to_zval_bool(zval *ret, encodeTypePtr type, xmlNodePtr data)
{
ZVAL_NULL(ret);
FIND_XML_NULL(data, ret);

if (data && data->children) {
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
whiteSpace_collapse(data->children->content);
if (stricmp((char*)data->children->content, "true") == 0 ||
stricmp((char*)data->children->content, "t") == 0 ||
strcmp((char*)data->children->content, "1") == 0) {
ZVAL_TRUE(ret);
} else if (stricmp((char*)data->children->content, "false") == 0 ||
stricmp((char*)data->children->content, "f") == 0 ||
strcmp((char*)data->children->content, "0") == 0) {
ZVAL_FALSE(ret);
} else {
ZVAL_STRING(ret, (char*)data->children->content);
convert_to_boolean(ret);
}
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
} else {
if (!data->children) {
ZVAL_NULL(ret);
return ret;
}
if (data->children->type != XML_TEXT_NODE || data->children->next != NULL) {
// TODO Convert to exception?
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}

whiteSpace_collapse(data->children->content);
if (
data->children->content[0] == '\0' /* Check for empty string */
|| strcmp((const char*)data->children->content, "0") == 0
|| strcmp((const char*)data->children->content, "f") == 0
|| strcmp((const char*)data->children->content, "false") == 0
) {
ZVAL_FALSE(ret);
} else {
ZVAL_TRUE(ret);
}
return ret;
}
Expand Down
Loading