Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[6.x]: CP nav items resolve to site URLs instead of CP URLs when cached outside CP requests

Chiusa
#19,807 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Start in CraftCms\Cms\Cp\Navigation::getTree() and trace its DependencyCache handling, then compare the use of Url::url() with Url::cpUrl(). Verify that relative CP navigation paths generated outside CP requests are cached with CP URLs rather than site URLs, while existing absolute URLs continue to work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug repo:cms
What happened?
Description

The latest alpha changed the behavior of my nav. I'm able to resolve it on my side but it may be a symptom of a behavior change worth sharing. I was previously passing in relative paths to NavItem and have updated to pass absolute URLs which don't get rendered with the wrong base path.

Per AI tooling:

It appears in CraftCms\Cms\Cp\Navigation, CP navigation items are cached server-side via DependencyCache for 1 hour in getTree(). During tree building, each item's URL is normalized using Url::url() instead of Url::cpUrl().

Because Url::url() checks request()->isCpRequest(), any process that triggers CP navigation generation outside of an active CP browser request (e.g. CLI Artisan commands, queue jobs, test suites, or front-end Twig calls) normalizes relative CP paths into site URLs instead of CP URLs, and bakes them into the 1-hour cache.

Craft CMS version

6.0.0-alpha.19

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions
Lingua principale
PHP
Stelle
3.6k
Fork
705
Merge medio
15h 22m
PR unite (30g)
218

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di craftcms/cms

Tutte le issue di craftcms/cms

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.