When files are uploaded via ajax and validation happens on the form, PHP 7 will throw a PHP notice on the following code:
elseif ($elements['#type'] == 'select'&& !$elements['#multiple'] && $elements['#required'] && !isset($elements['#default_value']) && $elements['#value'] === $elements['#empty_value']) {
To prevent the PHP notice, I've changed it as follows:
elseif ($elements['#type'] == 'select'&& $elements['#required'] && (!array_key_exists('#multiple', $elements) || !$elements['#multiple']) && !isset($elements['#default_value']) && $elements['#value'] === $elements['#empty_value']) {
Steps to reproduce:
* run the latest version of Drupal 7 on PHP 7.1
* install file entity module
* add fields to your image type file
* create an article
* upload an image (see the PHP notice after the image is uploaded via ajax)






