|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-18 14:23 UTC] dmitry@php.net
[2009-03-10 14:13 UTC] shaselboeck at m-s dot de
[2009-08-26 14:05 UTC] svn@php.net
[2009-08-26 14:06 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 12:00:01 2025 UTC |
Description: ------------ Setting up an SoapServer with another encoding as UTF-8 - for example Cp1252 - SoapServer->fault() will not correct encode the message. By throwing a SoapFault with an message, the encoding will be done correctly, but SoapServer->fault() does not. To suppress error, I run an internal encoding. mb_convert_encoding($string, 'UTF-8', $this->getEncoding()); Reproduce code: --------------- All code listed here is part of a complex class hierarchy in combination with the Zend Framework. -------------------------------------------- SERVER-CODE ----------------------- --------------------- $server = new SoapServer('http://xxx.de/?wsdl', array('encoding' => 'Cp1252')); $server->setClass('SoapFaultTest'); try { $server->handle(); } catch (Exception $e) { $this->fault('Sender', $e->getMessage()); } -------------------------------------------- CLIENT-CODE -------------------------------------------- try { $client = new SoapClient('http://xxx.de/?wsdl', array('encoding' => 'Cp1252')); echo $client->test(); } catch (SoapFault $fault) { echo 'Error: ' . $fault->getMessage(); } -------------------------------------------- SERVICE-CLASS SoapFaultTest -------------------------------------------- class SoapFaultTest { public function test() { throw new Exception('Exception with some special chars: ???'); } } Expected result: ---------------- Exception with some special chars: ??? Actual result: -------------- SOAP-ERROR: Encoding: string 'Exception with some special chars: \xc4...' is not a valid utf-8 string