File validation logic from #3221793 broke backwards compatibility

Created on 20 December 2023, 11 months ago
Updated 15 January 2024, 10 months ago

Problem/Motivation

The file validation logic changes in πŸ› Drupal\Component\Plugin\Exception\PluginNotFoundException: The "webform_file_validate_extensions" plugin does not exist Active broke backwards compatibility.

Prior to this change, any item defined in #upload_validators would be checked to see if it was a callback function, after that logic finished all of the values were passed through to hook_file_validate().

With this change, any item defined in #upload_validators is first checked to see if it is a callback, if it is not it is assumed to be a constraint plugin and it is passed to $this->constraintManager->create($validator, $options) inside \Drupal\file\Validation\FileValidator::validate(). This has caused problems with Webform, IMCE, and possibly others, along with possible custom file uploaders.

Steps to reproduce

Add arbitrary data to the '#upload_validators' form array key. A PluginNotFoundException will be thrown.

Proposed resolution

Catch PluginNotFoundException and trigger a deprecation warning that only valid plugin names will be allowed in the '#upload_validators' form array in Drupal 11.

Remaining tasks

Update change record as per #11

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.2 ✨

Component
File systemΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
  • Regression

    It restores functionality that was present in earlier versions.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024