Collection blueprints served from an addon directory fail with "Undefined array key 0"
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 22/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 4.9k
- Fork
- 647
- Merge trung bình
- 1 ngày 45 phút
- Pull request đã merge (30 ngày)
- 221
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của statamic/cms
-
forms ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
antlers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageCó thể đã có người làm @duncanmcclean đã nhận hôm nay. Đang mởnavigations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itCó thể đã có người làm @duncanmcclean đã nhận hôm nay. Đang mởforms
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
vimeo/psalm#15150 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
taskforcesh/bullmq#5238 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itCó thể đã có người làm @bfs2021 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/jetpack#55517 ·
Maintainer thường phản hồi trong vòng 1 ngày