xref: /PHP-8.2/ext/soap/tests/bugs/bug42214.phpt (revision 7f2f0c00)
1--TEST--
2Bug #42214 (SoapServer sends clients internal PHP errors)
3--EXTENSIONS--
4soap
5--FILE--
6<?php
7$request = <<<EOF
8<?xml version="1.0" encoding="UTF-8"?>
9<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/server.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope>
10EOF;
11
12function test() {
13    $a = $b;
14    obvious_error(); // will cause an error
15}
16
17$server = new SoapServer(NULL, array('uri' =>'http://localhost/server.php',
18    'send_errors'=>0));
19$server->addFunction('test');
20$server->handle($request);
21?>
22--EXPECT--
23<?xml version="1.0" encoding="UTF-8"?>
24<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Internal Error</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
25