json function only works with PHP 5.3
Reported by Chris Barnett | May 28th, 2009 @ 07:42 AM | in Release 0.3 - Citronnade
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);
}
}
Comments and changes to this ticket
-
Fabrice Luraine May 28th, 2009 @ 11:56 AM
- State changed from new to resolved
(from [f25a7742554816ac4cf3845ab9d266bd74daeee5]) Make json rendering function compatible with PHP < 5.3.0 [#4 state:resolved] http://github.com/sofadesign/limonade/commit/f25a7742554816ac4cf384...
-
Fabrice Luraine June 10th, 2009 @ 09:08 AM
- Milestone set to Release 0.3 - Citronnade
[milestone:ID#42088 bulk edit command]
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Limonade is a PHP micro-framework.
People watching this ticket
Referenced by
- 4 json function only works with PHP 5.3 (from [f25a7742554816ac4cf3845ab9d266bd74daeee5]) Make js...