Collection blueprints served from an addon directory fail with "Undefined array key 0"

Ouverte
#15,880 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@joshdaugherty y travaille déjà.

Depuis le 13/11/2026.

  • #15881 par @joshdaugherty — ouverte

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
22/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
laravel, php
Domaine
backend

Piste de recherche

Start in BlueprintRepository.php at makeBlueprintFromFile(), and compare its $additionalNamespaces lookup with how filesIn() normalizes collections/people to collections.people. Follow Collection::entryBlueprints() to see the call path. Work on this is already under way in PR #15881, so check that PR before starting. Done means a regression test for an addon-registered collection blueprint directory passes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

blueprints & fieldsets
Bug description

An addon that registers a collection blueprint directory with Blueprint::addNamespace('collections.people', $dir) (what AddonServiceProvider does with $blueprintNamespace) cannot have that collection's entry blueprints loaded.

Collection::entryBlueprints() calls Blueprint::in('collections/people'). filesIn() normalizes / to . and finds the addon directory, but then makeBlueprintFromFile($file, 'collections/people') looks the slash form up in $additionalNamespaces (keyed with dots), misses, and falls through to getNamespaceAndHandleFromPath() for a path outside every configured directory: ErrorException: Undefined array key 0 at BlueprintRepository.php:362 (6.40.0).

Expected: the blueprint loads, as it does through filesIn().

How to reproduce
  1. Register Blueprint::addNamespace('collections.people', '/path/with/people.yaml').
  2. Call Collection::make('people')->entryBlueprints().
  3. Observe ErrorException: Undefined array key 0.

Reproduced on 6.40.0 and on current 6.x (9d20aef).

Logs
ErrorException: Undefined array key 0 at BlueprintRepository.php:362
Environment
Statamic: 6.40.0 (also current 6.x, 9d20aef)

Found by reading the package source and reproducing it in the package's own test suite, not on a running site, so the full php please support:details output is not available.

Installation

Other (please explain): reproduced in the statamic/cms test suite, with an addon-style namespace registration.

Additional details

Fix: normalize the namespace in makeBlueprintFromFile() the same way filesIn() does. A pull request with a regression test follows.

Langage dominant
PHP
Étoiles
4.9k
Forks
647
Merge moyen
1 j 45 min
PR mergées (30 j)
221

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de statamic/cms

Toutes les issues de statamic/cms

Issues similaires

Plus d'issues PHP

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.