rdmpage / biorss

Harvest and repurpose RSS feeds
2 stars 0 forks source link

Sunra\PhpSimple\HtmlDomParser doesn't work on PHP 7.4.29 #16

Closed rdmpage closed 2 years ago

rdmpage commented 2 years ago

Sunra\PhpSimple\HtmlDomParser doesn't work on more recent versions of PHP (e.g., 7.4.29) throwing regular expression compilation errors. This is a know bug (see e.g. https://github.com/sunra/php-simple-html-dom-parser/issues/87) and there is at least one pull request to fix it (e.g., https://github.com/sunra/php-simple-html-dom-parser/pull/88) but looks like development has basically stopped so I can't simply update composer.json.

rdmpage commented 2 years ago

Fix is to remove from composer.json and add relevant files to repository:

|
+-- HtmlDomParser.php
|
+--simplehtmldom_1_5
   |
   +-- simple_html_dom.php

Then patch simple_html_dom.php. To include the class we simply:

require_once (dirname(__FILE__) . '/HtmlDomParser.php');

This loads the patched version of the code.

rdmpage commented 2 years ago

Fixed with c1fb32b9002583547f122a57539120d0320bb6e1