Go to file
C. Scott Ananian 25272e7a4a Don't refer directly to PHP dom extension classes; avoid nonstandard behavior
These changes ensure that DiscussionTools is independent of DOM
library choice, and will not break if/when Parsoid switches to an
alternate (more standards-compliant) DOM library.

We run `phan` against the Dodo standards-compliant DOM library,
so this ends up flagging uses of non-standard PHP extensions to
the DOM.  These will be suppressed for now with a "Nonstandard DOM"
comment that can be grepped for, since they will eventually
will need to be rewritten or worked around.

Most frequent issues:

* Node::nodeValue and Node::textContent and Element::getAttribute()
can return null in a spec-compliant implementation.  Add `?? ''` to
make spec-compliant results consistent w/ what PHP returns.

* DOMXPath doesn't accept anything except DOMDocument.  These uses
should be replaced with DOMCompat::querySelectorAll() or similar
(which end up using DOMXPath under the covers for DOMDocument any way,
but are implemented more efficiently in a spec-compliant
implementation).

* A couple of times we have code like:
  `while ($node->firstChild!==null) { $node = $node->firstChild; }`
and phan's analysis isn't strong enough to determine that $node is still
non-null after the while.  This same issue should appear with DOMDocument
but phan doesn't complain for some reason.

One apparently legit issue:

* Node::insertBefore() is once called in a funny way which leans on
the fact that the second option is optional in PHP.  This seems to be
a workaround for an ancient PHP bug, and can probably be safely
removed.

Bug: T287611
Bug: T217867
Change-Id: I3c4f41c3819770f85d68157c9f690d650b7266a3
2021-07-30 18:15:40 -04:00
.phan Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
i18n Localisation updates from https://translatewiki.net. 2021-07-26 08:12:04 +02:00
images Add beta feature preference 2020-02-21 15:20:48 +00:00
includes Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
maintenance Defensive use of dynamic paths in maintenance script 2020-02-20 19:51:07 +01:00
modules Merge "Change updating page content after saving to avoid losing footers" 2021-07-28 16:59:05 +00:00
sql Change DB column types from "string" to "binary" (VARCHAR to VARBINARY in MySQL) 2021-04-28 21:54:48 +00:00
tests Don't refer directly to PHP dom extension classes; avoid nonstandard behavior 2021-07-30 18:15:40 -04:00
.eslintignore build: Move eslint file list to .eslintignore 2021-03-04 18:09:34 +00:00
.eslintrc.json build: Updating eslint-config-wikimedia to 0.19.0 2021-03-13 10:51:31 +00:00
.gitignore Remove extra blank line from .gitignore file 2020-08-31 15:24:56 +01:00
.gitreview Add .gitreview 2019-10-09 21:18:34 +00:00
.phpcs.xml build: Updating mediawiki/mediawiki-codesniffer to 32.0.0 2020-10-29 10:53:01 +00:00
.stylelintrc.json Remove deprecated dt- classes 2021-03-23 12:39:34 +00:00
CODE_OF_CONDUCT.md build: Updating npm dependencies 2020-01-09 06:43:15 +00:00
composer.json build: Updating dependencies 2021-07-22 16:29:04 +00:00
COPYING Add required files for an extension 2019-10-10 19:42:56 +01:00
extension.json Use DOMCompat::newDocument() to create a new Document 2021-07-30 18:15:11 -04:00
Gruntfile.js build: Move eslint file list to .eslintignore 2021-03-04 18:09:34 +00:00
package-lock.json build: Updating dependencies 2021-07-22 16:29:04 +00:00
package.json build: Updating npm dependencies 2021-05-09 16:41:13 +00:00