From:             shaselboeck at m-s dot de
Operating system: Linux
PHP version:      5.2.8
PHP Bug Type:     SOAP related
Bug description:  Encoding bug in SoapServer->fault

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

-- 
Edit bug report at http://bugs.php.net/?id=47273&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47273&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47273&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47273&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47273&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47273&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47273&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47273&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47273&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47273&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47273&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47273&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47273&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47273&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47273&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47273&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47273&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47273&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47273&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47273&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47273&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47273&r=mysqlcfg

Reply via email to