PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm2 » Bug #6802

added rule -> heirselect

Details

Request #6802added rule -> heirselect
Submitted2006-02-16 20:58 UTC
Frommike at augustash dot com
Assignedavb
StatusClosed
PackageHTML_QuickForm2
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-02-16 20:58 UTC] mike at augustash dot com

Description:
------------
Through the documentation and a few quick looks through the source code there doesn't seem to be a way to validate a heir select without much manual processing.

I figured this was a rule that would be nice to add in since it will add better security to these heir selects. It does not check if everything was entered or required because that should be handled in a different step.

Test script:
---------------
function heir_key_exists($input, $opts) {
if (empty($input)) return false;
if (empty($opts)) return false;
$c = count($input);
$opts = $opts[$c-1];

for($i=0;$i<$c;$i++) {
if (!array_key_exists($input[$i], $opts)) return false;
$opts = $opts[$input[$i]];
}
return true;
}

Expected result:
----------------
This takes the input and validates that all of the keys in fact do exist by running up the array 1 by 1 utilizing array_key_exists.

Actual result:
--------------
There is no current rule to make this simple.