On testing the 2.0 alpha release on a new WAMP installation with PHP 5.4.3 I got a PHP notice:
PHP Notice: Array to string conversion in C:\wamp\www\xataface\lib\jscalendar\calendar.php on line 103
This is the relevant function.
- Code: Select all
function _make_js_hash($array) {
$jstr = '';
reset($array);
while (list($key, $val) = each($array)) {
if (is_bool($val))
$val = $val ? 'true' : 'false';
else if (!is_numeric($val))
$val = '"'.$val.'"';
if ($jstr) $jstr .= ',';
$jstr .= '"' . $key . '":' . $val;
}
return $jstr;
}
I was able to get rid of the notice by using implode. I also tried serialize, but could not get that to work.
- Code: Select all
function _make_js_hash($array) {
$jstr = '';
reset($array);
while (list($key, $val) = each($array)) {
if (is_bool($val))
$val = $val ? 'true' : 'false';
else if (is_array($val))
$val = '"'.(implode($val)).'"';
else if (!is_numeric($val))
$val = '"'.$val.'"';
if ($jstr) $jstr .= ',';
$jstr .= '"' . $key . '":' . $val;
}
return $jstr;
}
I think this is another case of later PHP versions being more picky. I'm posting this to bring it to your attention and hopefully confirm that it is an acceptable fix.