Collection blueprints served from an addon directory fail with "Undefined array key 0"
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- Meio dia
- Facilidade para iniciantes
- 22/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Register
Blueprint::addNamespace('collections.people', '/path/with/people.yaml'). - Call
Collection::make('people')->entryBlueprints(). - 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.
- Linguagem predominante
- PHP
- Estrelas
- 4.9k
- Forks
- 647
- Merge médio
- 1d 45min
- PRs com merge (30d)
- 221
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de statamic/cms
-
forms ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
accessibility
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
antlers
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageTalvez já em andamento @duncanmcclean assumiu hoje. Abertanavigations
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itTalvez já em andamento @duncanmcclean assumiu hoje. Abertaforms
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
Todas as issues de statamic/cms
Issues semelhantes
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
documentation good first issue help wanted up-for-grabs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
AnikethTS/RunnerDeck#307 ·
Mantenedores costumam responder em até 1 dia
-
sync-en
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
sync-en
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia
-
Перевод устарел
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia