[Solar-svn] Revision 2766

pmjones at solarphp.com pmjones at solarphp.com
Fri Sep 21 11:38:58 CDT 2007


branch: Solar_Filter: [CHG] To help alleviate infinite recursion in Model_Record objects, the method applyChain() now loops through the filters directly, instead of looping through each data element and then looking for the filters on that element.



Modified: branches/orm/Solar/Filter.php
===================================================================
--- branches/orm/Solar/Filter.php	2007-09-21 16:32:54 UTC (rev 2765)
+++ branches/orm/Solar/Filter.php	2007-09-21 16:38:58 UTC (rev 2766)
@@ -539,8 +539,9 @@
             }
         }
         
-        // loop through each data element
-        foreach ($this->_data as $key => $val) {
+        // loop through each filter set, where the key is the
+        // data element name.
+        foreach ($this->_chain_filters as $key => $filters) {
             
             // keep the key name
             $this->_data_key = $key;
@@ -552,11 +553,6 @@
                 continue;
             }
             
-            // are there filters on this key?
-            if (empty($this->_chain_filters[$key])) {
-                continue;
-            }
-            
             // is this key required?
             if (! empty($this->_chain_require[$key])) {
                 $this->setRequire(true);
@@ -565,13 +561,13 @@
             }
             
             // run the filters for the data element
-            foreach ($this->_chain_filters[$key] as $params) {
+            foreach ($filters as $params) {
                 
                 // take the method name off the top of the params ...
                 $method = array_shift($params);
                 
                 // ... and put the value in its place.
-                array_unshift($params, $val);
+                array_unshift($params, $this->_data[$key]);
                 
                 // call the filtering method
                 $result = $this->__call($method, $params);




More information about the Solar-svn mailing list