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