From:             dev at lechat dot org
Operating system: XP
PHP version:      5.1.0RC1
PHP Bug Type:     SOAP related
Bug description:  base64binary wrong decode

Description:
------------
With 5.0.5, a SOAP client getting a "base64Binary" datatype is not
performing the appropriate decoding.

Since Bug #32139 (base64binary encode/decode) this issue was marked
fixed.

With 5.1.0RC1, autodecode is present, but returns a wrong decode.

- PHP 5.0.5 : 
  -> SoapClient doesn't autodecode base64binary, it returns a base64
encoded string.
  -> base64_decode() did a wrong decode.
  -> GET EXPECTED results if use of mb_convert_encoding().

- PHP 5.1.0RC1 :
  -> SoapClient autodecode base64binary,
  -> but return a wrong decoded string


base64binary encoded string to be decode is not short, so I don't put it
in this report. Request if necessary. 

Reproduce code:
---------------
header('Content-Type: text/xml; charset=UTF-8');
$client = new SoapClient( 
        "http://192.168.72.75/MSWCONFIGWEBSERVICE/Deployment.asmx?WSDL";,
array('trace' => 1)
    ); 

$param = array(
                'schemaVersion' => 1,
                'user' => array(
                        'Username' => "myuser",
                        'Password' => "mypassword",
                        'CultureID' => 1033));


$result=$client->LoadConfiguration($param);

//PHP 5.0.5 : SoapClient doesn't autodecode base64binary
// return a base64 encoded string :
//PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PENv
bmZpZ3VyYXRpb24+PEtleSBuYW1lPSJ.....

//PHP 5.0.5 : base64_decode() did a wrong decode (*)
$conf=base64_decode($result->LoadConfigurationResult->Configuration);
echo $conf;

//PHP 5.0.5 : GET EXPECTED results if use of mb_convert_encoding()
$conf=mb_convert_encoding($result->LoadConfigurationResult->Configuration,"UTF-8","BASE64");
echo $conf;

//PHP 5.1.0RC1 : SoapClient autodecode base64binary, but return a wrong
decoded string ( same as *)
echo $result->LoadConfigurationResult->Configuration;

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Configuration>
          <Key name="CharacterSetAliases" default="">
                  <PropertyList duplicates="true">
                          <Property name="iso-646" type="string" 
value="us-ascii" /> 
                  </PropertyList>
          </Key>
...

Actual result:
--------------
This is the content of $result->LoadConfigurationResult->Configuration :

<?xml version="1.0" encoding="UTF-8"
standalone="no"?><Coù¹™¥ÕɅѥ½¸øñ-•䁹…µ”ô‰
¡…É…Ñ•ÉM•ѱ¥…͕̈‘•™…Õ±ÐôˆˆøñCç&÷W'G”Æ—7BGWƖ6FW3Ò'G'VR#ãÅ&÷W'G’æÖS
...

-- 
Edit bug report at http://bugs.php.net/?id=34641&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34641&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34641&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34641&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34641&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34641&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34641&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34641&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34641&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34641&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34641&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34641&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34641&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34641&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34641&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34641&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34641&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34641&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34641&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34641&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34641&r=mysqlcfg

Reply via email to