Wixel / GUMP

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data
https://wixelhq.com
MIT License
1.17k stars 341 forks source link

Filter can override field's array data with references to another non-array field data #316

Closed ocean90 closed 3 years ago

ocean90 commented 3 years ago

Example:

$gump = new GUMP();
$validation_rules = [
    'tags'  => 'required',
    'text'  => 'required',
];
$filter_rules = [
    'tags'  => 'sanitize_numbers',
    'text'  => 'boolean',
];
$gump->validation_rules( $validation_rules );
$gump->filter_rules( $filter_rules );

$data = [
    'tags' => [ '100a', 200 ],
    'text' => 'yes',
];

$validation_response = $gump->run( $data );

var_dump( $validation_response );

The above creates the following output:

array(2) {
  ["tags"]=>
  array(1) {
    [0]=>
    &bool(true) // This is not correct.
  }
  ["text"]=>
  &bool(true)
}
Raphael-MOUQUIN commented 3 years ago

+1