FriendsOfCake/cakephp-upload

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

mikerogerz opened this issue · 0 comments

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:

if (!$validator->isEmptyAllowed($field, false)) {