|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-02-06 22:39 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 03:00:01 2025 UTC |
Description: ------------ Hi, I got the following array and want to enode it to json format: print_r($hier); ------ ["ID"]=> int(254) ["XYID"]=> int(4) ["Inhalt"]=> string(127) "@hallowas geht " ["Name"]=> string(4) "falti" ["Datum"]=> string(19) "2010-02-06 17:57:54" ["Gru?"]=> string(14) "TOOTO|??|MOOTO" ["Affe"] => string (4) "Pans" ------ but the result was print_r(json_encode($hier)); ---- {"ID":254,"XYID":4,"Inhalt":"@hallowas geht ","Name":"falti","Datum":"2010-02-06 17:57:54","Gru?":null,"Affe":"Pans"} --- As you can see the string with the '?' char results a null in the encoded JSON. I uses the option Paramters (JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP) but nothing solved the problem, when I used other chars instead it worked properly. I saw someone having this Problem on a Linux and MacOs Machine with PHP 5.3 but the bug is still there on Windows machines with PHP 5.3.1 Reproduce code: --------------- print_r($hier); ------ ["ID"]=> int(254) ["XYID"]=> int(4) ["Inhalt"]=> string(127) "@hallowas geht " ["Name"]=> string(4) "falti" ["Datum"]=> string(19) "2010-02-06 17:57:54" ["Gru?"]=> string(14) "TOOTO|??|MOOTO" ["Affe"] => string (4) "Pans" ------ results: print_r(json_encode($hier)); ---- {"ID":254,"XYID":4,"Inhalt":"@hallowas geht ","Name":"falti","Datum":"2010-02-06 17:57:54","Gru?":null,"Affe":"Pans"} --- Expected result: ---------------- print_r($hier); ------ ["ID"]=> int(254) ["XYID"]=> int(4) ["Inhalt"]=> string(127) "@hallowas geht " ["Name"]=> string(4) "falti" ["Datum"]=> string(19) "2010-02-06 17:57:54" ["Gru?"]=> string(14) "TOOTO|??|MOOTO" ["Affe"] => string (4) "Pans" ------ but the result was print_r(json_encode($hier)); ---- {"ID":254,"XYID":4,"Inhalt":"@hallowas geht ","Name":"falti","Datum":"2010-02-06 17:57:54","Gru?":"TOOTO|??|MOOTO","Affe":"Pans"} --- Actual result: -------------- print_r(json_encode($hier)); ---- {"ID":254,"XYID":4,"Inhalt":"@hallowas geht ","Name":"falti","Datum":"2010-02-06 17:57:54","Gru?":null,"Affe":"Pans"} ---