Changeset 3602

Show
Ignore:
Timestamp:
10/15/2008 11:08:15 AM (7 weeks ago)
Author:
Shadowhand
Message:

Fixing a bug in Validation that would cause pre_filters and post_filters to not properly account for fields that are arrays.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/classes/validation.php

    r3536 r3602  
    472472                                        foreach ($fields as $f) 
    473473                                        { 
    474                                                 $this[$f] = call_user_func($callback, $this[$f]); 
     474                                                $this[$f] = is_array($this[$f]) ? array_map($callback, $this[$f]) : call_user_func($callback, $this[$f]); 
    475475                                        } 
    476476                                } 
    477477                                else 
    478478                                { 
    479                                         $this[$field] = call_user_func($callback, $this[$field]); 
     479                                        $this[$field] = is_array($this[$field]) ? array_map($callback, $this[$field]) : call_user_func($callback, $this[$field]); 
    480480                                } 
    481481                        } 
     
    617617                                        foreach ($fields as $f) 
    618618                                        { 
    619                                                 $this[$f] = call_user_func($callback, $this[$f]); 
     619                                                $this[$f] = is_array($this[$f]) ? array_map($callback, $this[$f]) : call_user_func($callback, $this[$f]); 
    620620                                        } 
    621621                                } 
    622622                                else 
    623623                                { 
    624                                         $this[$field] = call_user_func($callback, $this[$field]); 
     624                                        $this[$field] = is_array($this[$field]) ? array_map($callback, $this[$field]) : call_user_func($callback, $this[$field]); 
    625625                                } 
    626626                        }