Parse cookie values "{}" & "[]" as array

This commit is contained in:
Luis Ramos 2013-10-30 15:26:50 -06:00
parent 9d87f6fcb5
commit db63ba2d8f

View file

@ -534,7 +534,7 @@ class CookieComponent extends Component {
$first = substr($string, 0, 1);
if ($first === '{' || $first === '[') {
$ret = json_decode($string, true);
return ($ret) ? $ret : $string;
return ($ret !== null) ? $ret : $string;
}
$array = array();
foreach (explode(',', $string) as $pair) {