You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Ropu <ro...@gmail.com> on 2008/06/07 03:20:26 UTC
Bug in PHP Json_decoder??
Check this code for GadgetDataServlet.php line ~80
error_log('JSON: '. print_r($requestParam, true));
$requests = json_decode($requestParam, true);
error_log('DECODED: '. print_r($requests, true));
where $requestParam = isset($_POST['request']) ? $_POST['request'] : '';
and check the result!
seeams that is* typing the Fields!*
Doubles and ints are NOT treated as strings!!!
so we have different floating points and ints overflow! grrrrrrrr
ideas?
JSON:
[{"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField1","value":
*3.410306969554683*},
{"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField2","value"
*:22.72713329258661*},
{"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField3","value":
*1212801019364*}]
DECODED: Array
(
[0] => Array
(
[type] => UPDATE_PERSON_APP_DATA
[idSpec] => VIEWER
[key] => AppField1
[value] =>* 3.4103069695547*
)
[1] => Array
(
[type] => UPDATE_PERSON_APP_DATA
[idSpec] => VIEWER
[key] => AppField2
[value] => *22.727133292587*
)
[2] => Array
(
[type] => UPDATE_PERSON_APP_DATA
[idSpec] => VIEWER
[key] => AppField3
[value] => *2147483647*
)
)
--
.-. --- .--. ..-
R o p u
Re: Bug in PHP Json_decoder??
Posted by Ropu <ro...@gmail.com>.
and just FYI
*Note:* The data stored in an OpenSocial application is always a string. For
most purposes, it is practical to make this a JSON
<http://www.json.org/>-encoded
string. Because OpenSocial performs automatic HTML escaping of all returned
data including application data, you must unescape stringified JSON objects
in the appdata store before parsing them. For example:
http://code.google.com/apis/opensocial/docs/0.7/devguide.html#Persistent
ropu
On Fri, Jun 6, 2008 at 6:20 PM, Ropu <ro...@gmail.com> wrote:
> Check this code for GadgetDataServlet.php line ~80
>
> error_log('JSON: '. print_r($requestParam, true));
> $requests = json_decode($requestParam, true);
> error_log('DECODED: '. print_r($requests, true));
>
> where $requestParam = isset($_POST['request']) ? $_POST['request'] : '';
>
> and check the result!
>
> seeams that is* typing the Fields!*
>
> Doubles and ints are NOT treated as strings!!!
>
> so we have different floating points and ints overflow! grrrrrrrr
>
> ideas?
>
>
> JSON:
> [{"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField1","value":
> *3.410306969554683*},
>
> {"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField2","value"
> *:22.72713329258661*},
>
> {"type":"UPDATE_PERSON_APP_DATA","idSpec":"VIEWER","key":"AppField3","value":
> *1212801019364*}]
>
> DECODED: Array
> (
> [0] => Array
> (
> [type] => UPDATE_PERSON_APP_DATA
> [idSpec] => VIEWER
> [key] => AppField1
> [value] =>* 3.4103069695547*
> )
>
> [1] => Array
> (
> [type] => UPDATE_PERSON_APP_DATA
> [idSpec] => VIEWER
> [key] => AppField2
> [value] => *22.727133292587*
> )
>
> [2] => Array
> (
> [type] => UPDATE_PERSON_APP_DATA
> [idSpec] => VIEWER
> [key] => AppField3
> [value] => *2147483647*
> )
>
> )
>
>
>
>
>
> --
> .-. --- .--. ..-
> R o p u
--
.-. --- .--. ..-
R o p u