fix infinite loop

line 30 results in an infinite loop that will never terminate. i just had to fix this locally to get the server running.
Merge pull request #146 from FabianFrank/patch-1

fix infinite loop
Some more json_encode fixed for PHP < 5.2

From http://www.stetsenko.net/2009/09/php-json_encode-before-5-2-0/