xref: /php-src/ext/soap/tests/bug68996.phpt (revision 7f2f0c00)
1--TEST--
2Bug #68996 (Invalid free of CG(interned_empty_string))
3--EXTENSIONS--
4soap
5--SKIPIF--
6<?php
7if (getenv("USE_ZEND_ALLOC") !== "0")
8    print "skip Need Zend MM disabled";
9?>
10--FILE--
11<?php
12$s = new SoapServer(NULL, [
13    'uri' => 'http://foo',
14]);
15
16function foo() {
17  return new SoapFault("\xfc\x63", "some msg");
18}
19$s->addFunction("foo");
20
21// soap 1.1
22$HTTP_RAW_POST_DATA = <<<EOF
23<?xml version="1.0" encoding="UTF-8"?>
24<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
25  <SOAP-ENV:Body>
26    <SOAP-ENV:foo />
27  </SOAP-ENV:Body>
28</SOAP-ENV:Envelope>
29EOF;
30$s->handle($HTTP_RAW_POST_DATA);
31
32// soap 1.2
33$HTTP_RAW_POST_DATA = <<<EOF
34<?xml version="1.0" encoding="UTF-8"?>
35<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
36  <env:Body>
37    <env:foo />
38  </env:Body>
39</env:Envelope>
40EOF;
41$s->handle($HTTP_RAW_POST_DATA);
42?>
43--EXPECT--
44<?xml version="1.0" encoding="UTF-8"?>
45<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode></faultcode><faultstring>some msg</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
46<?xml version="1.0" encoding="UTF-8"?>
47<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value></env:Value></env:Code><env:Reason><env:Text>some msg</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
48