From 8b87b3eacd92de074ad4690c7d212f05df4e527a Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 18 Oct 2006 20:24:45 +0000 Subject: [PATCH] Nesting level too deep bug fixed --- lib/Doctrine/Collection.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Collection.php b/lib/Doctrine/Collection.php index 8cce4b621..8a6f731d5 100644 --- a/lib/Doctrine/Collection.php +++ b/lib/Doctrine/Collection.php @@ -500,8 +500,15 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator if(isset($this->reference_field)) $record->set($this->reference_field, $this->reference, false); - if(array_search($record, $this->data) !== false) - return false; + /** + * for some weird reason in_array cannot be used here (php bug ?) + * + * if used it results in fatal error : [ nesting level too deep ] + */ + foreach($this->data as $val) { + if($val === $record) + return false; + } if(isset($key)) { if(isset($this->data[$key]))