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

Đang mở
#7,727 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, wordpress
Lĩnh vực
backend, web-dev

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
31
Fork
7
Merge trung bình
7 giờ 50 phút
Pull request đã merge (30 ngày)
822

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Automattic/blocks-engine

Tất cả issue của Automattic/blocks-engine

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.