From aee25f82df36362dea8b6a9f3a4c7ebef376c726 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Fri, 25 May 2007 08:24:22 +0000 Subject: [PATCH] fix for a sometime not terminating loop. patch provided by knut moeller --- phpgwapi/inc/class.bolink.inc.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/phpgwapi/inc/class.bolink.inc.php b/phpgwapi/inc/class.bolink.inc.php index 4bf97bb271..4ed07051c0 100644 --- a/phpgwapi/inc/class.bolink.inc.php +++ b/phpgwapi/inc/class.bolink.inc.php @@ -257,16 +257,26 @@ class bolink extends solink $only_app = substr(1,$only_app); } end($id); - while ($link = current($id)) - { - if (!is_array($link) || // check for unlink-marker - $only_app && $not_only == ($link['app'] == $only_app)) + foreach (array_reverse($id) as $link) { + if (is_array($link) // check for unlink-marker + && !($only_app && $not_only == ($link['app'] == $only_app))) { - continue; + $ids[$link['link_id']] = $only_app ? $link['id'] : $link; } - $ids[$link['link_id']] = $only_app ? $link['id'] : $link; - prev($id); } + # the old version of the foreach from above + # left here for reference. can be deleted later + # + #while ($link = current($id)) + #{ + # if (!is_array($link) || // check for unlink-marker + # $only_app && $not_only == ($link['app'] == $only_app)) + # { + # continue; + # } + # $ids[$link['link_id']] = $only_app ? $link['id'] : $link; + # prev($id); + #} } return $ids; }