FriendsOfCake / cakephp-upload

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

Context data empty when adding validation rules to field with behavior applied #516

Closed mikerogerz closed 2 years ago

mikerogerz commented 5 years ago

Affects CakePHP 3.7.*

When applying additional validation rules to behavior-applied fields, data array is empty in callback context ($context['data'], for example).

For example: $validation->allowEmptyFile('filename', function ($context) { })

$context['data'] will be empty. This also breaks the ability to use either 'create' or 'update' instead of a function.

The culprit seems to be at the following line: https://github.com/FriendsOfCake/cakephp-upload/blob/7d21c546bbf718e95b011c1c9a42a689d076ea6f/src/Model/Behavior/UploadBehavior.php#L64