Fixes conditions build for the advanced search.
authorStéphane Jacob <sj@m4x.org>
Sun, 13 Dec 2009 15:43:16 +0000 (16:43 +0100)
committerStéphane Jacob <sj@m4x.org>
Sun, 13 Dec 2009 17:45:54 +0000 (18:45 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/search/classes.inc.php

index 4f7b4a3..62ec5d5 100644 (file)
@@ -443,7 +443,7 @@ class RefSField extends SField
 
     function too_large()
     {
-        return ($this->value=='');
+        return ($this->value == '');
     }
 
     // }}}
@@ -581,7 +581,7 @@ class StringSField extends SField
 
     function too_large()
     {
-        return ($this->length()<2);
+        return ($this->length() < 2);
     }
 
     // }}}
@@ -767,11 +767,14 @@ class SFieldGroup
     {
         $this->fields = $_fields;
         $this->and    = $_and;
-        foreach ($this->fields as $key=>&$field) {
-            if (is_null($field)) {
-                unset($this->fields[$key]);
+
+        $cleanFields = array();
+        foreach ($this->fields as $field) {
+            if (!is_null($field)) {
+                $cleanFields[] = $field;
             }
         }
+        $this->fields = $cleanFields;
     }
 
     // }}}
@@ -780,7 +783,7 @@ class SFieldGroup
     function too_large()
     {
         $b = true;
-        for ($i=0 ; $b && $i<count($this->fields) ; $i++) {
+        for ($i = 0; $b && $i < count($this->fields); ++$i) {
             if (!is_null($this->fields[$i])) {
                 $b = $b && $this->fields[$i]->too_large();
             }