Annotation of embedaddon/php/ext/soap/tests/bugs/bug47273.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #47273 (Encoding bug in SoapServer->fault)
                      3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --INI--
                      6: unicode.script_encoding=ISO-8859-1
                      7: unicode.output_encoding=ISO-8859-1
                      8: --FILE--
                      9: <?php
                     10: $request1 = <<<EOF
                     11: <?xml version="1.0" encoding="UTF-8"?>
                     12: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://127.0.0.1:8080/test/" 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:test1/></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     13: EOF;
                     14: $request2 = <<<EOF
                     15: <?xml version="1.0" encoding="UTF-8"?>
                     16: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://127.0.0.1:8080/test/" 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:test2/></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     17: EOF;
                     18: 
                     19: class SoapFaultTest
                     20: {
                     21:     public function test1() {
                     22:        //  Test #1
                     23:         return 'Test #1 exception with some special chars: Äßö';
                     24:     }
                     25:     public function test2() {    
                     26:         //  Test #2
                     27:        //throw new SoapFault('Server', 'Test #2 exception with some special chars: Äßö');
                     28:         throw new Exception('Test #2 exception with some special chars: Äßö');
                     29:     }
                     30: }
                     31: 
                     32: $server = new SoapServer(null, array(
                     33: 'uri' => "http://127.0.0.1:8080/test/",
                     34: 'encoding' => 'ISO-8859-1'));
                     35: $server->setClass('SoapFaultTest');
                     36: 
                     37: try {
                     38:        $server->handle($request1);
                     39: } catch (Exception $e) {
                     40:        $server->fault("Sender", $e->getMessage());
                     41: }
                     42: try {
                     43:         $server->handle($request2);
                     44: } catch (Exception $e) {
                     45:         $server->fault("Sender", $e->getMessage());
                     46: }
                     47: ?>
                     48: --EXPECT--
                     49: <?xml version="1.0" encoding="UTF-8"?>
                     50: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://127.0.0.1:8080/test/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test1Response><return xsi:type="xsd:string">Test #1 exception with some special chars: Äßö</return></ns1:test1Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     51: <?xml version="1.0" encoding="UTF-8"?>
                     52: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>Sender</faultcode><faultstring>Test #2 exception with some special chars: Äßö</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     53: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>