Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 303519

ConstraintManager::getDefinitionsByType does not validate definitions and can lead to a crash

$
0
0

Problem/Motivation

Spinning from #3513113: Drupal core's ConstraintManager has poor DX, leading to XB triggering Validation constraint "type" must be an array of types

The definition has the key type which is intended to be an array, which isn't clear at all. If someone makes a mistake there is a WSOD due to passing a string to in_array

     if ($definition['type'] === FALSE || in_array($type, $definition['type'])) {
        $definitions[$plugin_id] = $definition;
      }

Steps to reproduce

See https://git.drupalcode.org/project/experience_builder/-/merge_requests/786

Proposed resolution

Cast type to an array, always. Or provide validation and error with an exception to clearly state what must be fixed.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 303519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>