PHP requires you to call $el->setIdAttribute('id') after creating *each* \DOMElement in order for DOMDocument::getElementById() to execute efficiently.
Description
Details
Related Objects
- Mentioned In
- T232180: Zest.php: Pagebundle routes timeout for some pages
T230861: PHP 7.2 is very slow on an allocation-intensive benchmark - Mentioned Here
- T217696: Remex doesn't set ID attributes
T215000: Fill gaps in PHP DOM's functionality
rMLZEd118dcc45b80: Expose getElementsById/getElementsByTagName
rGPAR10dedbbeb626: Add DOMCompat classes to support the DOM methods missing from PHP DOM
Event Timeline
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
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
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
Change 535291 merged by jenkins-bot:
[mediawiki/libs/RemexHtml@master] Call the non-standard \DOMElement::setIdAttribute() method by default