Page MenuHomePhabricator

Edge case in processing templated extlink with an entity-encoded ] char in the url
Closed, ResolvedPublic

Description

$ echo "[{{1x|1=https://foo.bar?foo=bar]}} bar]" | php bin/parse.php
<p data-parsoid='{"dsr":[0,43,0,0]}'>[<a rel="mw:ExtLink nofollow" href="https://foo.bar?foo=bar%5D" about="#mwt4" typeof="mw:Transclusion" class="external free" data-parsoid='{"stx":"url","a":{"href":"https://foo.bar?foo=bar%5D"},"sa":{"href":"https://foo.bar?foo=bar]"},"pi":[[{"k":"1","named":true}]],"dsr":[1,38,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"https://foo.bar?foo=bar&amp;#93;"}},"i":0}}]}'>https://foo.bar?foo=bar]</a> bar]</p>

$ echo "[{{1x|1=https://foo.bar?foo=bar&#93;}} bar]" | php ../core/maintenance/parse.php 
<p><a rel="nofollow" class="external text" href="https://foo.bar?foo=bar%5D">bar</a>
</p>

This was reported here.

Event Timeline

ssastry renamed this task from Edge case in extlink tokenization to Edge case in processing templated extlink with an entity-encoded ] char in the url.Jun 2 2026, 9:17 PM
ssastry updated the task description. (Show Details)

Change #1297780 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] Allow invalid extlink chars encoded as entities

https://gerrit.wikimedia.org/r/1297780

Change #1297780 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Allow invalid extlink chars encoded as entities

https://gerrit.wikimedia.org/r/1297780

Change #1299571 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8

https://gerrit.wikimedia.org/r/1299571

Change #1299571 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8

https://gerrit.wikimedia.org/r/1299571

Change #1299588 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8

https://gerrit.wikimedia.org/r/1299588

Change #1299588 merged by jenkins-bot:

[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8

https://gerrit.wikimedia.org/r/1299588

Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:41:15Z] <cscott@deploy1003> cscott: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:50:28Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]] (duration: 11m 13s)