From 0f9bacb81a68529aa1277a0e5e0dceaafb6812c4 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 10 Nov 2009 21:34:16 -0500 Subject: [PATCH] fix infinite recursion bug --- classes/ComicPressStoryline.inc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/classes/ComicPressStoryline.inc b/classes/ComicPressStoryline.inc index dfe41ac..55f28db 100644 --- a/classes/ComicPressStoryline.inc +++ b/classes/ComicPressStoryline.inc @@ -156,10 +156,13 @@ class ComicPressStoryline { if (isset($this->_structure[$id])) { $all_adjacent = array(); do { - if ($has_adjacent = isset($this->_structure[$id][$direction])) { - $all_adjacent[] = $this->_structure[$id][$direction]; - $id = $this->_structure[$id][$direction]; - } + $has_adjacent = false; + if (!in_array($id, $all_adjacent)) { + if ($has_adjacent = isset($this->_structure[$id][$direction])) { + $all_adjacent[] = $this->_structure[$id][$direction]; + $id = $this->_structure[$id][$direction]; + } + } } while ($has_adjacent); return $all_adjacent; }