daylerees / sanitizer

Sanitize data using a number of mutation methods.
259 stars 22 forks source link

Update Sanitizer.php #10

Closed TimothyLoyer closed 8 years ago

TimothyLoyer commented 10 years ago

Fix issue where values without assigned sanitizer(s) would be returned back as an array by putting the value and parameters in $parameterSet, and making sure that $value only ever contains the original value or the returned, sanitized value.

TimothyLoyer commented 10 years ago

Quick example of the result:

    protected $rules = [
        'file_name'                 => 'trim',
        'file_type'                 => 'trim',
        'size'                      => '',
        'mimetype'                  => 'trim',
    ];

Before sanitizer:

array (size=7)
  'file_name' => string 'larger glasses' (length=14)
  'file_type' => string 'gif' (length=3)
  'size' => int 508339
  'mimetype' => string 'image/gif' (length=9)

After sanitizer:

array (size=7)
  'file_name' => string 'larger glasses' (length=14)
  'file_type' => string 'gif' (length=3)
  'size' => 
    array (size=1)
      0 => int 508339
  'mimetype' => string 'image/gif' (length=9)
TimothyLoyer commented 9 years ago

I'm not sure that this pull request would still work, but this is still a problem on the current version.