Problem/Motivation
A route with _maintenance_access: 'false' is exempt from maintenance mode. MaintenanceMode::applies() treats the non-empty string as true. With unquoted false, maintenance mode applies to the route.
Quoting false can also prevent access. With _ignore_create_bundle_access: 'false', EntityCreateAnyAccessCheck::access() skips the check for permission to create a bundle. An account that can create a bundle but cannot create entities of any existing bundle therefore loses access to the entity add page.
Steps to reproduce
- With maintenance mode enabled, compare
MaintenanceMode::applies()for a test route with_maintenance_access: falseand the same route with_maintenance_access: 'false'. It returnsTRUEfor the boolean andFALSEfor the string. - On an entity add route, use a test account that can create a bundle but cannot create entities of any existing bundle. With
_ignore_create_bundle_access: false,EntityCreateAnyAccessCheck::access()allows access. With_ignore_create_bundle_access: 'false', it no longer does.
Proposed resolution
Use BooleanRouteOption::get() from #3644412: [PP-1] Routing treats "false" as TRUE for _admin_route and no_cache in MaintenanceMode::applies() and EntityCreateAnyAccessCheck::access().
Test that maintenance mode still applies with _maintenance_access: 'false' and that permission to create a bundle still grants access to the add page with _ignore_create_bundle_access: 'false'. In each case, expect a deprecation naming the option.
Remaining tasks
Postponed on #3644412: [PP-1] Routing treats "false" as TRUE for _admin_route and no_cache.
In Drupal 13: Track rejection of deprecated inputs in #3644403: [13.x] Reject deprecated non-boolean input in boolean config values.
User interface changes
None.
API changes
The _maintenance_access and _ignore_create_bundle_access route options follow the boolean input rules from #3644412: [PP-1] Routing treats "false" as TRUE for _admin_route and no_cache. Use unquoted booleans in routing YAML and native booleans in PHP.
Data model changes
None.
Release notes snippet
The _maintenance_access and _ignore_create_bundle_access route options now treat the deprecated string 'false' as FALSE.
Issue fork drupal-3644423
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments