Changeset 2626
- Timestamp:
- 05/05/08 11:56:32 (2 months ago)
- Files:
-
- trunk/system/libraries/Validation.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/system/libraries/Validation.php
r2618 r2626 363 363 )); 364 364 365 // Copy the array from the object, to optimize multiple sets 366 $object_array = $this->getArrayCopy(); 367 365 368 foreach ($all_fields as $i => $field) 366 369 { … … 372 375 } 373 376 374 if (isset($this->array_fields[$field])) 375 { 376 // Use the first key for the field 377 $field_key = $this->array_fields[$field]; 378 379 // Load the field as an array 380 $this[$field_key] = (array) Kohana::key_string($field, $this); 377 if (substr($field, -2) === '.*') 378 { 379 // Set the key to be an array 380 Kohana::key_string_set($object_array, substr($field, 0, -2), array()); 381 381 } 382 382 else 383 383 { 384 // Make sure all fields are defined 385 isset($this[$field]) or $this[$field] = NULL; 386 } 387 } 384 // Set the key to be NULL 385 Kohana::key_string_set($object_array, $field, NULL); 386 } 387 } 388 389 // Swap the array back into the object 390 $this->exchangeArray($object_array); 388 391 389 392 // Reset all fields to ALL defined fields … … 399 402 { 400 403 // Process each filter 401 $this[$f] = is_array($this[$f]) ? array_map($func, $this[$f]) : call_user_func($func, $this[$f]); 404 if (is_array($this[$f])) 405 { 406 array_walk_recursive($this[$f], $func); 407 } 408 else 409 { 410 $this[$f] = call_user_func($func, $this[$f]); 411 } 402 412 } 403 413 } … … 405 415 { 406 416 // Process each filter 407 $this[$field] = is_array($this[$field]) ? array_map($func, $this[$field]) : call_user_func($func, $this[$field]); 417 if (is_array($this[$field])) 418 { 419 array_walk_recursive($this[$field], $func); 420 } 421 else 422 { 423 $this[$field] = call_user_func($func, $this[$field]); 424 } 408 425 } 409 426 }
