From f25a7742554816ac4cf3845ab9d266bd74daeee5 Mon Sep 17 00:00:00 2001 From: Fabrice Luraine Date: Thu, 28 May 2009 11:56:00 +0200 Subject: [PATCH] Make json rendering function compatible with PHP < 5.3.0 [#4 state:resolved] --- lib/limonade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/limonade.php b/lib/limonade.php index f45d976..761e968 100644 --- a/lib/limonade.php +++ b/lib/limonade.php @@ -1262,7 +1262,7 @@ function txt($content_or_func, $layout = '', $locals = array()) function json($data, $json_option = 0) { header('Content-Type: application/x-javascript; charset='.strtolower(option('encoding'))); - return json_encode($data, $json_option); + return version_compare(PHP_VERSION, '5.3.0', '>=') ? json_encode($data, $json_option) : json_encode($data); } /**