Page MenuHomePhabricator

Remex does not use \DOMElement::setIdAttribute('id') by default
Closed, ResolvedPublic

Description

PHP requires you to call $el->setIdAttribute('id') after creating *each* \DOMElement in order for DOMDocument::getElementById() to execute efficiently.

Event Timeline

cscott renamed this task from Remex does not use \DOMDocument::setIdAttribute('id') by default to Remex does not use \DOMElement::setIdAttribute('id') by default.Sep 9 2019, 8:38 PM
cscott updated the task description. (Show Details)

Change 535289 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/services/parsoid@master] Use DOMElement::setIdAttribute() where necessary for efficiency

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

Change 535291 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/libs/RemexHtml@master] Call the non-standard \DOMElement::setIdAttribute() method by default

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

This is a workaround for https://bugs.php.net/bug.php?id=77686 and other issues related to inconsistent indexing behavior. See also the implementation of DOMCompat::getElementById in 10dedbbeb626aa614b5931c07035675e01590259 and the implementation of getElementById in Zest, for example in d118dcc45b803917e5e34d60712b893b3892d5ac, and the discussion in T215000#4993172 and T215000#4994273 and the PHP documentation in https://www.php.net/manual/en/domdocument.getelementbyid.php and https://www.php.net/manual/en/domelement.setidattribute.php

Change 535289 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Use DOMElement::setIdAttribute() where necessary for efficiency

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

Change 535291 merged by jenkins-bot:
[mediawiki/libs/RemexHtml@master] Call the non-standard \DOMElement::setIdAttribute() method by default

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

tstarling assigned this task to cscott.
tstarling subscribed.

This was fixed, right?