Page MenuHomePhabricator

Parsoid/PHP adds a data-sort-value="", lang="" whereas Parsoid/JS doesn't
Closed, ResolvedPublic

Description

Possibly an empty / null check which '' is failing in PHP.

Ex: enwiki: Bobbi Kristina Brown

----- JS:[57938, 58268] -----
<td style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" typeof="mw:Transclusion" about="#mwtX" data-parsoid='{"dsr":[28587,28595,1,0],"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"N/a","href":"./Template:N/a"},"params":{},"i":0}}]}'>N/A

+++++ PHP:[57938, 58287] +++++
<td data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" typeof="mw:Transclusion" about="#mwtX" data-parsoid='{"dsr":[28587,28595,1,0],"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"N/a","href":"./Template:N/a"},"params":{},"i":0}}]}'>N/A

Ex: enwiki:Cátulo_Castillo

----- JS:[39035, 39744] -----
<div style="font-style:italic;text-align:left" typeof="mw:Extension/poem" about="#mwtX" data-parsoid='{"src":"&lt;poem style=\"font-style:italic;text-align:left\" lang=\"\">\"El águila y el gusano llegaron a la cima de una montaña. El gusano se ufanaba de ello. El águila aclaró: &apos;Vos llegaste trepando, yo volando&apos;. ¿Pájaros o gusanos? He aquí una pregunta clave.\"\n&lt;/poem>"}' data-mw='{"name":"poem","attrs":{"style":"font-style:italic;text-align:left","lang":""},"body":{"extsrc":"\"El águila y el gusano llegaron a la cima de una montaña. El gusano se ufanaba de ello. El águila aclaró: &apos;Vos llegaste trepando, yo volando&apos;. ¿Pájaros o gusanos? He aquí una pregunta clave.\"\n"}}'>

+++++ PHP:[39043, 39760] +++++
<div style="font-style:italic;text-align:left" lang="" typeof="mw:Extension/poem" about="#mwtX" data-parsoid='{"src":"&lt;poem style=\"font-style:italic;text-align:left\" lang=\"\">\"El águila y el gusano llegaron a la cima de una montaña. El gusano se ufanaba de ello. El águila aclaró: &apos;Vos llegaste trepando, yo volando&apos;. ¿Pájaros o gusanos? He aquí una pregunta clave.\"\n&lt;/poem>"}' data-mw='{"name":"poem","attrs":{"style":"font-style:italic;text-align:left","lang":""},"body":{"extsrc":"\"El águila y el gusano llegaron a la cima de una montaña. El gusano se ufanaba de ello. El águila aclaró: &apos;Vos llegaste trepando, yo volando&apos;. ¿Pájaros o gusanos? He aquí una pregunta clave.\"\n"}}'>

Details

Related Gerrit Patches:
mediawiki/services/parsoid : masterParsoid/JS: Fix bug in Sanitizer.js

Event Timeline

ssastry triaged this task as Normal priority.Oct 11 2019, 6:38 PM
ssastry created this task.
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptOct 11 2019, 6:38 PM
ssastry renamed this task from Parsoid/PHP adds a data-sort-value="" whereas Parsoid/JS doesn't to Parsoid/PHP adds a data-sort-value="", lang="" whereas Parsoid/JS doesn't.Oct 11 2019, 6:43 PM
ssastry updated the task description. (Show Details)
ssastry moved this task from Backlog to Bugs on the Parsoid-PHP board.Oct 11 2019, 6:52 PM

This is probably a Parsoid/JS bug as demonstrated by this test case

[subbu@earth:~/work/wmf/parsoid] node bin/parse.js --dump tplsrc --body_only < /tmp/wt
================================================================================
TEMPLATE: Template:N/a ; TRANSCLUSION: "{{N/a}}"
--------------------------------------------------------------------------------
data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" | N/A
--------------------------------------------------------------------------------
<table data-parsoid='{"dsr":[0,14,2,2]}'>
<tbody data-parsoid='{"dsr":[3,12,0,0]}'><tr data-parsoid='{"autoInsertedStart":true,"dsr":[3,11,0,0]}'><td style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"dsr":[3,11,1,0],"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"N/a","href":"./Template:N/a"},"params":{},"i":0}}]}'>N/A</td></tr>
</tbody></table>

[subbu@earth:~/work/wmf/parsoid] php bin/parse.php --dump tplsrc --body_only < /tmp/wt
[dump/tplsrc] ================================================================================
[dump/tplsrc] TEMPLATE: Template:N/a ; TRANSCLUSION: "{{N/a}}"
[dump/tplsrc] --------------------------------------------------------------------------------
[dump/tplsrc] data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" | N/A
[dump/tplsrc] --------------------------------------------------------------------------------
<table data-parsoid='{"dsr":[0,14,2,2]}'>
<tbody data-parsoid='{"dsr":[3,12,0,0]}'><tr data-parsoid='{"autoInsertedStart":true,"dsr":[3,11,0,0]}'><td data-sort-value="" style="background: #ececec; color: #2C2C2C; vertical-align: middle; font-size: smaller; text-align: center; " class="table-na" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"dsr":[3,11,1,0],"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"N/a","href":"./Template:N/a"},"params":{},"i":0}}]}'>N/A</td></tr>
</tbody></table>

Inspecting the N/A entries of the table in the https://en.wikipedia.org/wiki/Bobbi_Kristina_Brown#Music section shows that the core parser emits data-sort-value="" as well. So, this is a Parsoid/JS bug in the AttributeTransformManager probably.

ssastry claimed this task.Oct 11 2019, 10:23 PM

Change 542612 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Parsoid/JS: Fix bug in Sanitizer.js

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

Change 542612 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Parsoid/JS: Fix bug in Sanitizer.js

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

ssastry closed this task as Resolved.Oct 15 2019, 11:48 PM
ssastry moved this task from Bugs to Parsoid/JS bugs on the Parsoid-PHP board.Oct 17 2019, 3:28 PM