Gargron / fileupload

PHP FileUpload library that supports chunked uploads
MIT License
460 stars 87 forks source link

Fixed bug with setMessages() in Validator/Simple.php #17

Closed nilov closed 8 years ago

Gargron commented 9 years ago

Err, what bug are we talking about here? The method is supposed to override default messages, but now you're concatenating them instead which makes little sense as the arrays in question are actually hashes.

nilov commented 9 years ago

method array_merge() with int keys does not replace the values, will be creates new keys. Check this code:

var_dump(array_merge(array(0 => 'value'), array(0 => 'new value')));

the output will be: array(2) { [0]=> string(5) "value" [1]=> string(9) "new value" }

Gargron commented 9 years ago

Oh, I see! Good catch. Concatenating them instead doesn't solve the problem though, does it? I wish PHP had explicit hashes instead of this mess.