From: mikx at mikx dot de
Operating system: Linux, Windows
PHP version: 5.2.6
PHP Bug Type: *Unicode Issues
Bug description: wddx_serialize_value does not handle unicode properly
Description:
------------
wddx_serialize_value does not deal as expected with unicode characters in
PHP 5.2.x or PHP 5.3.x. The function worked differently in PHP 5.1.6.
When serializing a string or a more complex objects any unicode characters
get again utf8 encoded - instead of getting in as is.
Reproduce code:
---------------
<a href="?utf8=%E9%A1%B5">Demo</a> (some chinese character)
<hr>
<form method="get" action="?">
<input type="text" name="utf8">
<input type="submit">
</form>
<hr>
<?php
if (isset($_GET["utf8"])) {
echo $_GET["utf8"]."<br>";
echo utf8_encode($_GET["utf8"])."<br>";
echo wddx_serialize_value($_GET["utf8"])."<br>";
}
?>
Expected result:
----------------
The demo code is a little script that outputs the given query parameter
"utf8" in three way:
1. Directly as recieved
2. utf8_encoded
3. serialized via wddx_serialize_value
In <= 5.1.6 the resulting WDDX contained the utf8 characters excatly as
given. In >= 5.2.0 the string gets UTF8 encoded again, just as if you would
have valled utf8_encode on it.
Actual result:
--------------
While the new behavior might make sense for data going forward (although i
am not sure what the expected behavior by WDDX spec is) this breaks
backward compatibility with old data.
As we have millons of database rows in unicode WDDX data this is a huge
issue (at least to us).
Can you please clarify if this is a bug, the expected behavior going
forward and how to deal with backward compatibility issues (maybe an
additional parameter to control the behavior)?
This might be related to bug #41722
--
Edit bug report at http://bugs.php.net/?id=45314&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45314&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45314&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45314&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45314&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45314&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45314&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45314&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45314&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45314&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45314&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45314&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45314&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45314&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45314&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45314&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45314&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45314&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45314&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45314&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45314&r=mysqlcfg