mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 13:32:43 -05:00
Use PHP 8.4+ \Dom classes and functions (#9567)
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
* https://github.com/FreshRSS/simplepie/pull/97
* https://github.com/simplepie/simplepie/pull/939
* https://github.com/simplepie/simplepie/pull/1019
SimplePie: Use PHP 8.4+ \Dom classes and functions
* https://github.com/FreshRSS/simplepie/pull/98
* https://github.com/simplepie/simplepie/issues/1021
SimplePie: Add unit test for HTML5 sanitizing compliance
* https://github.com/simplepie/simplepie/pull/1022
SimplePie: Remove obsolete xml_is_sane and XMLReader fallback
* https://github.com/simplepie/simplepie/pull/1023
CssXPath: Add support for case insensitivity
* https://github.com/phpgt/CssXPath/pull/256
fix https://github.com/FreshRSS/FreshRSS/issues/5201
fix https://github.com/FreshRSS/FreshRSS/issues/6830
fix https://github.com/FreshRSS/FreshRSS/issues/6831
~5% faster for HTML sanitising.
Remove SimpleXML. Remove XMLReader.
This commit is contained in:
1 parent
5ad167e6f3
commit
ea646d2bde
44 files changed
+1004
-615
No files matched your search
@@ -146,3 +146,41 @@ jobs:
|
||||
|
||||
- name: Check spelling
|
||||
run: bin/typos
|
||||
|
||||
# https://github.com/shivammathur/setup-php
|
||||
tests-oldest-php:
|
||||
name: tests PHP 8.2
|
||||
runs-on: ubuntu-26.04
|
||||
|
||||
steps:
|
||||
- name: Git checkout source code
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Use PHP 8.2
|
||||
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
|
||||
with:
|
||||
php-version: '8.2'
|
||||
|
||||
- name: Check PHP syntax
|
||||
run: composer run-script php-lint
|
||||
|
||||
- name: Check PHTML syntax
|
||||
run: composer run-script phtml-lint
|
||||
|
||||
- name: Use Composer cache
|
||||
id: composer-cache
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Run Composer install
|
||||
run: composer install --prefer-dist --no-progress
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run PHP unit tests
|
||||
run: composer run-script phpunit -- --no-progress
|
||||
Reference in new issue
Block a user