### Problem/Motivation

`BuilderMenuItems::getDerivativeDefinitions()` reads `$menu['menu_parent']` inside `str_replace()` before the `?? 'system.admin_config'` fallback:

$menu = $configPageType->get('menu');
$parentMenu = str_replace('admin:', '', $menu['menu_parent']) ?? 'system.admin_config';

When a config page type has no menu configured, `$configPageType->get('menu')` returns NULL, so `$menu['menu_parent']` throws "Trying to access array offset on null" on every cache rebuild. The `??` is also misplaced: it guards the return value of `str_replace()` (never NULL), not the array access.

### Steps to reproduce

Create a translatable config pages type with no menu configured, then run `drush cr`:

[warning] Trying to access array offset on null BuilderMenuItems.php:51

### Proposed resolution

Guard the array access with `isset()` while keeping the intended default:

$parentMenu = isset($menu['menu_parent']) ? str_replace('admin:', '', $menu['menu_parent']) : 'system.admin_config';

### Remaining tasks

Review and commit the MR.

### User interface changes

None.

### API changes

None.

### Data model changes

None.

Command icon 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

ethant created an issue.

  • luigisa committed 9ea97fbe on 1.0.x authored by ethant
    Issue #3605984: Guard null menu before array offset access in...