Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

json function only works with PHP 5.3

#4

in limonade.php:

function json($data, $json_option = 0)
{
   header('Content-Type: application/x-javascript; charset='.strtolower(option('encoding')));
   return json_encode($data, $json_option);
}

This fails in PHP versions prior to 5.3, where there was no second parameter to json_encode.

A simple (but ugly) fix would be:

function json($data, $json_option = 0)
{
   header('Content-Type: application/x-javascript; charset='.strtolower(option('encoding')));
   if(version_compare(PHP_VERSION, '5.3.0', '>=')) {
     return json_encode($data, $json_option);
   } else {
     return json_encode($data); 
   }
}

Reported by Chris Barnett · May 28th, 2009 @ 07:42 AM

State: resolved
Assigned to: nobody

Activity

  1. Fabrice Luraine
  2. Fabrice Luraine
    Fabrice Luraine

    thks for your (not so ugly) fix ;-)

    May 28th, 2009 @ 11:58 AM

  3. Fabrice Luraine
    Fabrice Luraine

    [milestone:none bulk edit command]

    June 10th, 2009 @ 09:08 AM

  4. Fabrice Luraine
    Fabrice Luraine
    • Milestone set to Release 0.3 - Citronnade

    [milestone:ID#42088 bulk edit command]

    June 10th, 2009 @ 09:08 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.