- Fixed memory leaks in openssl streams context options. (Pierre)
- Fixed handling of extremely long paths inside tempnam() function. (Ilia)
+- Fixed bug #38055 (Wrong interpretation of boolean parameters). (Dmitry)
- Fixed bug #38019 (segfault extending mysqli class). (Dmitry)
- Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules).
(Dmitry)
stricmp(data->children->content,"t") == 0 ||
strcmp(data->children->content,"1") == 0) {
ZVAL_BOOL(ret, 1);
- } else {
+ } else if (stricmp(data->children->content,"false") == 0 ||
+ stricmp(data->children->content,"f") == 0 ||
+ strcmp(data->children->content,"0") == 0) {
ZVAL_BOOL(ret, 0);
+ } else {
+ ZVAL_STRING(ret, data->children->content, 1);
+ convert_to_boolean(ret);
}
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
static xmlNodePtr to_xml_bool(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
xmlNodePtr ret;
- zval tmp;
ret = xmlNewNode(NULL,"BOGUS");
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
- if (Z_TYPE_P(data) != IS_BOOL) {
- tmp = *data;
- zval_copy_ctor(&tmp);
- convert_to_boolean(data);
- data = &tmp;
- }
-
- if (data->value.lval == 1) {
+ if (zend_is_true(data)) {
xmlNodeSetContent(ret, "true");
} else {
xmlNodeSetContent(ret, "false");
}
- if (data == &tmp) {
- zval_dtor(&tmp);
- }
-
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
--- /dev/null
+--TEST--
+Bug #38055 (Wrong interpretation of boolean parameters)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function Test($param) {
+ global $g1, $g2;
+ $g1 = $param->boolA;
+ $g2 = $param->boolB;
+ return 1;
+}
+
+class TestSoapClient extends SoapClient {
+ function __construct($wsdl) {
+ parent::__construct($wsdl);
+ $this->server = new SoapServer($wsdl);
+ $this->server->addFunction('Test');
+ }
+
+ function __doRequest($request, $location, $action, $version) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+}
+
+$client = new TestSoapClient(dirname(__FILE__).'/bug38055.wsdl');
+$boolA = 1;
+$boolB = '1';
+$res = $client->Test(array('boolA'=>$boolA, 'boolB'=>$boolB));
+var_dump($g1);
+var_dump($g2);
+?>
+--EXPECT--
+bool(true)
+bool(true)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<definitions\r
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"\r
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"\r
+ xmlns:s="http://www.w3.org/2001/XMLSchema"\r
+ xmlns:s0="http://test.pl"\r
+ targetNamespace="http://test.pl"\r
+ xmlns="http://schemas.xmlsoap.org/wsdl/">\r
+ <types>\r
+ <s:schema elementFormDefault="qualified" targetNamespace="http://test.pl">\r
+ <s:complexType name="Test">\r
+ <s:attribute use="required" name="boolA" type="s:boolean"/>\r
+ <s:attribute use="required" name="boolB" type="s:boolean"/>\r
+ </s:complexType>\r
+ <s:element type="s0:Test" name="Test"/>\r
+ <s:element type="s:int" name="Ret"/>\r
+ </s:schema>\r
+ </types>\r
+\r
+ <message name="TestSoapIn">\r
+ <part name="parameters" element="s0:Test"/>\r
+ </message>\r
+ <message name="TestSoapOut">\r
+ <part name="parameters" element="s0:Ret"/>\r
+ </message>\r
+ <portType name="TestSoap">\r
+ <operation name="Test">\r
+ <input message="s0:TestSoapIn"/>\r
+ <output message="s0:TestSoapOut"/>\r
+ </operation>\r
+ </portType>\r
+ <binding name="TestSoap" type="s0:TestSoap">\r
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>\r
+ <operation name="Test">\r
+ <soap:operation soapAction="http:/Test/Test" style="document"/>\r
+ <input>\r
+ <soap:body use="literal"/>\r
+ </input>\r
+ <output>\r
+ <soap:body use="literal"/>\r
+ </output>\r
+ </operation>\r
+ </binding>\r
+ <service name="Test">\r
+ <port name="TestSoapPort" binding="s0:TestSoap">\r
+ <soap:address location="http://localhost/server.php"/>\r
+ </port>\r
+ </service>\r
+</definitions>
\ No newline at end of file