Non-ASCII source URLs move to opaque segment-<hash> slugs; WordPress supports UTF-8 slugs natively

Aperta
#7,727 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php, wordpress
Ambito
backend, web-dev

Direzione di ricerca

Start with php-transformer/src/Path/RouteSlug.php and its RouteSlug docblock to understand why non-ASCII segments become hashes. Trace how that result is used for post_name, permalinks, navigation links, templates, and route classes, then locate the relevant fixture tests. Done means Arabic and CJK routes retain distinct native WordPress slugs in stored post names, permalinks, and nav links while internal identities remain valid.

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

Descrizione

Problem

RouteSlug::segment() replaces any path segment that does not fold to ASCII (Arabic, CJK, Cyrillic, Greek, Hebrew) with the opaque token segment-<sha256[:12]>. That token becomes the page's post_name, its permalink, and its template slug. Every non-Latin source URL therefore moves. A 301 keeps old links working, but the imported site's own URLs are hashes that the owner cannot read or recognize.

WordPress has no such limit: sanitize_title_with_dashes() keeps UTF-8 letters, percent-encoded through utf8_uri_encode(), so /الصور/ is a normal WordPress permalink. #3331 treated a moved source URL as a bug (underscores); this is the same class of fidelity loss, at site scale for non-Latin sites.

Evidence (mostafa-atef.com, Arabic Wix site, DLA 0.43.24, SSI 1.42.31)

  • 31 of 47 imported pages have post_name segment-*. Titles stay correct Arabic.
  • GET /الصور/ returns 301 → /segment-bfbd183ae97c/, and the nav links point at /segment-…/.
  • Templates are named page-segment-6ea79cc5df8c, which is opaque in the Site Editor.

Context

The current design is deliberate (see the RouteSlug docblock): the canonical route grammar is [a-z0-9_-], so segments that WordPress would percent-encode get a derived token. The question is where that grammar needs to hold:

  • Internal identities (template slugs, CSS route classes, artifact paths) can keep an ASCII token.
  • The public route (post_name, permalinks, nav hrefs) can carry WordPress's own slug for the segment, so the source URL is preserved.

Expected / acceptance

  • A non-ASCII source path imports with WordPress's native slug for that path. /الصور stays /الصور/ (stored percent-encoded, as core stores it), with no redirect needed.
  • Template and route-class identities stay valid under their own grammars.
  • Two distinct non-ASCII segments never collide.
  • A fixture with an Arabic and a CJK route asserts the stored post_name, the permalink, and the nav hrefs.

Filed by Franklin (Claude Opus via Roadie/Pi) from the mostafa-atef.com import loop. Evidence comes from the imported site's wp post list, curl, and php-transformer/src/Path/RouteSlug.php on trunk.

Lingua principale
PHP
Stelle
31
Fork
7
Merge medio
7h 50m
PR unite (30g)
822

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 Automattic/blocks-engine

Tutte le issue di Automattic/blocks-engine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.