#1084: Validation may not purge arrays that failed validation
------------------------+---------------------------------------------------
Reporter: david | Owner: dominik
Type: defect | Status: new
Priority: normal | Milestone: 1.0.1
Component: validation | Version: 1.0.0
Severity: critical | Keywords:
Has_patch: 0 |
------------------------+---------------------------------------------------
Description changed by david:
Old description:
> Two examples when this may happen
> 1. Direct validation of an array, and not elements inside it, e.g. using
> the {{{arraylength}}} validator. Failure of the validator should remove
> the array and all children.
> 1. An operator validator (e.g. {{{AgaviAndOperatorValidator}}}) defines
> an argument base for the child validators. In this case, any failing
> child validator should result in the respective array entry being
> removed.
> {{{
> #!xml
> <validator class="and">
> <arguments base="users[]"><argument /></arguments>
> <validator class="string">
> <argument>name</argument>
> </validator>
> <validator class="email">
> <argument>email</argument>
> </validator>
> </validator>
> }}}
>
> In both cases, the parameters remain in the request data - in example 2,
> there will still be {{{users[2]}}} with {{{users[2][name]}}} inside even
> if {{{users[2][email]}}} is invalid. In example 1, the array validated by
> the {{{arraylength}}} validator is left untouched even if it fails to
> validate.
New description:
Two examples of when this may happen:
1. Direct validation of an array, and not elements inside it, e.g. using
the {{{arraylength}}} validator. Failure of the validator should remove
the array and all children.
1. An operator validator (e.g. {{{AgaviAndOperatorValidator}}}) defines
an argument base for the child validators. In this case, any failing child
validator should result in the respective array entry being removed.
{{{
#!xml
<validator class="and">
<arguments base="users[]"><argument /></arguments>
<validator class="string">
<argument>name</argument>
</validator>
<validator class="email">
<argument>email</argument>
</validator>
</validator>
}}}
In both cases, the parameters remain in the request data - in example 2,
there will still be {{{users[2]}}} with {{{users[2][name]}}} inside even
if {{{users[2][email]}}} is invalid. In example 1, the array validated by
the {{{arraylength}}} validator is left untouched even if it fails to
validate.
--
--
Ticket URL: <http://trac.agavi.org/ticket/1084#comment:1>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets