#1189: Validation drops first element in multi-dimensional array exports
--------------------------------------+-------------------------------------
Reporter: hzilla <h...@…> | Owner: dominik
Type: defect | Status: new
Priority: normal | Milestone: 1.0.2
Component: validation | Version: 1.0.1
Severity: normal | Keywords:
Has_patch: 1 |
--------------------------------------+-------------------------------------
Changes (by david):
* owner: david => dominik
* component: util => validation
Old description:
> When exporting a multi-dimensional non-associative array from a custom
> validator, the first element in the exported array (key 0) is empty.
>
> $this->export(array(array('val0','val1'), array('val2','val3'));
>
> exports
>
> array
> 0 =>
> array
> empty
> 1 =>
> array
> 0 => string 'val2' (length=4)
> 1 => string 'val3' (length=4)
>
> This is because on line 266 of AgaviArrayPathDefinition.class.php there
> is a check:
>
> if($cur)
>
> which evaluates false when the first character in the flattened array
> path string is 0. Can be fixed by replacing with:
>
> if($cur != '')
New description:
When exporting a multi-dimensional non-associative array from a custom
validator, the first element in the exported array (key 0) is empty.
{{{
$this->export(array(array('val0','val1'), array('val2','val3'));
}}}
exports
{{{
array
0 =>
array
empty
1 =>
array
0 => string 'val2' (length=4)
1 => string 'val3' (length=4)
}}}
This is because on line 266 of AgaviArrayPathDefinition?.class.php there
is a check:
{{{
if($cur)
}}}
which evaluates false when the first character in the flattened array path
string is 0. Can be fixed by replacing with:
{{{
if($cur != '')
}}}
--
--
Ticket URL: <http://trac.agavi.org/ticket/1189#comment:2>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets