Skip to content

Remove obsolete xml_is_sane and XMLReader fallback - #1023

Open
Alkarex wants to merge 3 commits into
simplepie:masterfrom
FreshRSS:remove-xmlreader
Open

Alkarex wants to merge 3 commits into
simplepie:masterfrom
FreshRSS:remove-xmlreader

Conversation

@Alkarex

@Alkarex Alkarex commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Nothing of that seems relevant anymore for PHP 7.4+

Nothing of that seems relevant anymore for PHP 7.4+
@Alkarex

Alkarex commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Alkarex added a commit to FreshRSS/simplepie that referenced this pull request Nov 19, 2026
https://wiki.php.net/rfc/domdocument_html5_parser
https://wiki.php.net/rfc/opt_in_dom_spec_compliance

Polyfill `Dom\` classes for PHP < 8.4.

Needs PHPStan 2+: #97

Needed for fixing issues such as FreshRSS/FreshRSS#5201

Currently, SimplePie uses legacy DOMDocument parsing, which outputs potentially problematic HTML, not correctly sanitised.
This breaks the assumption that one can use something like `<div><!-- some HTML sanitized from SimplePie --></div>`.

```
--- Expected
+++ Actual
@@ @@
 '<ul>
-    <li><div></div></li>
+    <li><div>
     <li>Item</li>
-</ul>'
+</div></li></ul>'
```

When shown in a compliant Web browser, several tags will be wrongly closed, breaking the layout of the client.

This PR patches SimplePie to use the modern parser and code syntax, while maintaining a best-effort polyfill for legacy PHP versions < 8.4.

Downstream:
* FreshRSS/FreshRSS#9567

Upstream:
* simplepie#1021
* simplepie#1022
* simplepie#1023
Alkarex added a commit to FreshRSS/FreshRSS that referenced this pull request Nov 19, 2026
Currently, SimplePie uses legacy DOMDocument parsing, which outputs potentially problematic HTML, not correctly sanitised.
This breaks the assumption that one can use something like `<div><!-- some HTML sanitized from SimplePie --></div>`.

```
--- Expected
+++ Actual
@@ @@
 '<ul>
-    <li><div></div></li>
+    <li><div>
     <li>Item</li>
-</ul>'
+</div></li></ul>'
```

When shown in a compliant Web browser, several tags will be wrongly closed, breaking the layout of the client.

This PR patches SimplePie to use the modern parser and code syntax, while maintaining a best-effort polyfill for legacy PHP versions < 8.4.

Depends on:

SimplePie: Upgrade to PHPStan 2
* FreshRSS/simplepie#97
* simplepie/simplepie#939
* simplepie/simplepie#1019

SimplePie: Use PHP 8.4+ \Dom classes and functions
* FreshRSS/simplepie#98
* simplepie/simplepie#1021

SimplePie: Add unit test for HTML5 sanitizing compliance
* simplepie/simplepie#1022

SimplePie: Remove obsolete xml_is_sane and XMLReader fallback
* simplepie/simplepie#1023

CssXPath: Add support for case insensitivity
* phpgt/CssXPath#256

fix #5201
fix #6830
fix #6831

~5% faster for HTML sanitising.
Remove SimpleXML. Remove XMLReader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant