FriendsOfCake / cakephp-upload

CakePHP: Handle file uploading sans ridiculous automagic
https://cakephp-upload.readthedocs.io/
MIT License
551 stars 255 forks source link

Strict check for file upload error causes failure. #505

Closed challgren closed 5 years ago

challgren commented 5 years ago

CakePHP 3.7.4 FOC/cakephp-upload 4.0 Apache 2.4.38 PHP 7.2.15 macOS 10.14.3 Apache, PHP, mariaDB installed via HomeBrew

When uploading a file it is expected the file is saved and the database entity is saved. However due to a strict check on Line 90 https://github.com/FriendsOfCake/cakephp-upload/blob/master/src/Model/Behavior/UploadBehavior.php#L90 this code block always trigger because Hash::get((array)$entity->get($field), 'error') returns string '0' (length=1) when the strict check is for int 0 ex define ('UPLOAD_ERR_OK', 0);