Skip to content

[PHP] Preserve decoded URL suffixes in structured block markup - #570

Open
adamziel wants to merge 1 commit into
codex/structured-block-markup-processorfrom
codex/preserve-url-suffix-bytes
Open

[PHP] Preserve decoded URL suffixes in structured block markup#570
adamziel wants to merge 1 commit into
codex/structured-block-markup-processorfrom
codex/preserve-url-suffix-bytes

Conversation

@adamziel

@adamziel adamziel commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Structured block URLs now replace only the mapped scheme, authority, and pathname prefix in the decoded URL value. The unmatched path, query, and fragment bytes reach the existing HTML, CSS, or block serializer unchanged.

StructuredBlockMarkupUrlProcessor uses WPURL::replace_base_url() as the semantic result, locates only source boundaries marked by literal delimiters, and reparses the edited URL before accepting it. Ambiguous source spellings stay unchanged, and the cautious token pass is skipped for that token so it cannot bypass the failed boundary check.

The rewriter caches only the selected mapping index. Each occurrence still computes its own source-preserving URL, so equal parsed URLs with different source spellings do not share rendered output. The selected mapping’s own source base is used instead of the first configured base.

This is stacked on #625.

Testing

cd tests
../vendor/bin/phpunit UrlRewriting

The URL-rewriting suite passes with 430 tests and 2,716 assertions (7 pre-existing skips). PHPStan, PHPCompatibility 7.4+, targeted PHPCS, and git diff --check pass.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.9

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 10.05 s 9.77 s ⚪ +273 ms (+2.8%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.82 s 3.81 s ⚪ +16 ms (+0.4%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.87 s 13.58 s ⚪ +289 ms (+2.1%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

@adamziel
adamziel force-pushed the codex/preserve-url-suffix-bytes branch from 66a5bda to 71f935e Compare August 13, 2026 15:52
@adamziel adamziel changed the title [PHP] Replace mapped URL bases without re-encoding suffixes [PHP] Preserve unmatched URL suffixes in block markup rewrites Aug 13, 2026
@adamziel
adamziel force-pushed the codex/preserve-url-suffix-bytes branch 2 times, most recently from 153fe63 to d0e7cd0 Compare August 13, 2026 21:40
@adamziel adamziel changed the title [PHP] Preserve unmatched URL suffixes in block markup rewrites [PHP] Limit structured URL updates to mapped base ranges Aug 13, 2026
@adamziel
adamziel force-pushed the codex/preserve-url-suffix-bytes branch from d0e7cd0 to ec4a8f7 Compare August 14, 2026 00:02
@adamziel adamziel changed the title [PHP] Limit structured URL updates to mapped base ranges [PHP] Preserve decoded URL suffixes in structured block markup Aug 14, 2026
@adamziel
adamziel force-pushed the codex/preserve-url-suffix-bytes branch from ec4a8f7 to 7a45b45 Compare August 14, 2026 12:52
@adamziel
adamziel force-pushed the codex/preserve-url-suffix-bytes branch from 7a45b45 to 5ed660e Compare August 14, 2026 21:22
@adamziel
adamziel changed the base branch from trunk to codex/structured-block-markup-processor August 14, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant