Ticket #505 (closed Bug: fixed)

Opened 5 months ago

Last modified 5 months ago

Issue with extending Validation

Reported by: jonathangordon Owned by: Shadowhand
Priority: minor Milestone: 2.2
Component: Libraries:Validation Version: SVN HEAD
Keywords: validation empty fields skip method Cc:

Description

On line 382 ($Id: Validation.php 2143 2008-02-22 19:23:19Z Geert $):

if (($func[1] !== 'required' AND $func[1] !== 'matches') AND $this[$field] == NULL)

That shouldn't be hard coded.

I added a method myself which needs to run on empty fields, which required me to duplicate that entire method just to add 'or_set'. I could have set it as a callback, and duplicated all the logic, needlessly, to parse the arguments I needed to pass to it, but I didn't want to. It seems like a waste of CPU to do that twice.

I suggest a protected array which can hold the values of which methods should run on empty fields. That would be easy to duplicate when extending the library. Maybe you'll have a better idea.

Change History

Changed 5 months ago by Shadowhand

  • owner changed from - No owner - to Shadowhand
  • status changed from new to assigned

Fixed in

Changed 5 months ago by Shadowhand

  • status changed from assigned to closed
  • resolution set to fixed

r2494. (D'oh!)

Note: See TracTickets for help on using tickets.