Try to read a empty array?
Posted: Tue Apr 05, 2005 8:41 am
File: functions.inc.php;
Line: 124 (DMX04);
Error: Try to read a empty array;
Solution: Test if variable is array before foreach.
if(is_array($ary)){ // My sugestion start here
// original code start here
foreach ($ary as $data) {
if ($parentid === VIEWMODE_LINEAR || !isset($data[$parent_name]) || $data[$parent_name] == $parentid) {
$data['depth'] = $depth;
$_resArray[] = $data;
if ($data[$child_name] && $parentid !== VIEWMODE_LINEAR ) {
serendipity_walkRecursive($ary, $child_name, $parent_name, $data[$child_name], ($depth+1));
}
}
}
// original code ends here
}
Line: 124 (DMX04);
Error: Try to read a empty array;
Solution: Test if variable is array before foreach.
if(is_array($ary)){ // My sugestion start here
// original code start here
foreach ($ary as $data) {
if ($parentid === VIEWMODE_LINEAR || !isset($data[$parent_name]) || $data[$parent_name] == $parentid) {
$data['depth'] = $depth;
$_resArray[] = $data;
if ($data[$child_name] && $parentid !== VIEWMODE_LINEAR ) {
serendipity_walkRecursive($ary, $child_name, $parent_name, $data[$child_name], ($depth+1));
}
}
}
// original code ends here
}