Hi Stefan,
thanks a lot for that tip! That will definitely do the trick when using PHP
version >= 5.2!
Could the attached patch be applied to the 0.7.x legacy branch, please
(Derrell?)
Unfortunately we run PHP versions less than 5.2, so the problem still appears
on those systems.
So, if anybody can still help fixing the cause in JSON.phps, please do so ;)
I am currently not 100% sure where to look at...and regex have never been on
my personal list of "things I like to analyze" ;)
Thanks again for the tip,
Peter
> Hi Peter,
>
> just in case you are using a PHP version of at least 5.2:
> please consider letting PHP do the JSON en-/decoding natively. It might
> save you a huge amount of server power, as the encoding and decoding is
> then done in current PHP's own function; the JSON.phps would become
> redundant.
>
> I actually thought that the use of the native function would be
> incorporated in the backend by now (hadn't checked it out in a while).
> There had been a discussion on this topic many months ago in this list,
> IIRC.
>
> Anyway, my recommendation for you, in case your PHP version matches, is
> to back up your backend's index.php file and then search and replace any
> $json->decode with json_decode and likewise $json->encode with json_encode.
>
> I assume that the PHP native function would be free of the mentioned
> error (ain't no means to test it right now to prove that right now), so
> you might get rid of the fault the easy way.
>
> Good luck,
>
> Stefan
>
> Peter Schneider wrote:
>> Hi Helder,
>>
>>> [...]
>>> I haven't confirmed this but... Are you experiencing this using the SVN code
>>> or a specific release?
>>> [...]
>> Sorry, forgot to mention that (as always, hmmmm):
>> I am using qooxdoo 0.7.4-pre (trunk of the legacy branch).
>>
>>
>>> [...] As Andreas has said it worked for him, you might be
>>> suffering from an issue which may already be fixed in trunk. Please post
>>> qooxdoo release version or SVN revision.
>> Andreas' Post was about the Java backend implementation, my problem seems to
>> be
>> specific to (at least) the PHP backend implementation.
>> Unfortunately the decoding seems to be pretty different there (Java), so I
>> was
>> not yet able to take any advantage from looking at the Java implementation
>> :-/
>>
>>> Hope this helps,
>>>
>>> Helder Magalhães
>> Unfortunately, not ;) But thanks anyway.
>>
>> Peter
Index: qooxdoo/backend/php/services/index.php
===================================================================
--- qooxdoo/backend/php/services/index.php (revision 14514)
+++ qooxdoo/backend/php/services/index.php (working copy)
@@ -497,7 +497,12 @@
case "application/json":
/* We found literal POSTed json-rpc data (we hope) */
$input = file_get_contents('php://input');
- $jsonInput = $json->decode($input);
+ if (function_exists("json_decode"))
+ {
+ $jsonInput = json_decode($input);
+ } else {
+ $jsonInput = $json->decode($input);
+ }
break;
default:
@@ -520,9 +525,16 @@
$scriptTransportId = $_GET["_ScriptTransport_id"];
$error->SetScriptTransportId($scriptTransportId);
$input = $_GET["_ScriptTransport_data"];
- $jsonInput = $json->decode(get_magic_quotes_gpc()
+ if (function_exists("json_decode"))
+ {
+ $jsonInput = json_decode(get_magic_quotes_gpc()
? stripslashes($input)
: $input);
+ } else {
+ $jsonInput = $json->decode(get_magic_quotes_gpc()
+ ? stripslashes($input)
+ : $input);
+ }
}
else
{
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel