php-simple-html-dom-parser icon indicating copy to clipboard operation
php-simple-html-dom-parser copied to clipboard

Not compatible with php 7.3

Open vistart opened this issue 5 years ago • 16 comments

PHP Warning 'yii\base\ErrorException' with message 'preg_match(): Compilation failed: invalid range in character class at offset 4'

in .../sunra/php-simple-html-dom-parser/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php:1378

https://github.com/sunra/php-simple-html-dom-parser/blob/master/Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php#L1378

vistart avatar Dec 13 '18 08:12 vistart

I got the same error

oza75 avatar Dec 15 '18 09:12 oza75

php 7.3 has some bugs in preg_* function

wotupset avatar Dec 16 '18 23:12 wotupset

@wotupset Not bugs. PHP 7.3 has updated its regular expression engine to PCRE2, which brings some breaking changes.

I think the dash in referenced expression needs to be escaped.

More: http://php.net/manual/en/migration73.other-changes.php#migration73.other-changes.pcre

ArniPL avatar Dec 17 '18 13:12 ArniPL

There's even a PR opened two months ago that fixes this: #63 but it's left unmerged. This package might be abandoned.

ArniPL avatar Dec 17 '18 13:12 ArniPL

7.3 compatible version: https://github.com/Kub-AT/php-simple-html-dom-parser

Author of original PHP Simple HTML DOM Parser (sourceforge hosted) did an update on 2018-12-10 (after 6 year ;)) version 1.7 is compatible with PHP 7.3 https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.7/

Kub-AT avatar Jan 03 '19 07:01 Kub-AT

careful with 1.8.1 which is the version used by https://github.com/Kub-AT/php-simple-html-dom-parser

This version doesn't work as expected for example:

$dom->find('div[class=name]', 0);

The above fails if the div has more than 1 class. I'm currently working with version 1.7.1 which doesn't have this issue.

luigitek avatar Apr 10 '19 22:04 luigitek

careful with 1.8.1 which is the version used by https://github.com/Kub-AT/php-simple-html-dom-parser

This version doesn't work as expected for example:

$dom->find('div[class=name]', 0);

The above fails if the div has more than 1 class. I'm currently working with version 1.7.1 which doesn't have this issue.

It would be nice if you reported a bug here https://sourceforge.net/p/simplehtmldom/bugs/

Kub-AT avatar Apr 11 '19 06:04 Kub-AT

careful with 1.8.1 which is the version used by https://github.com/Kub-AT/php-simple-html-dom-parser This version doesn't work as expected for example: $dom->find('div[class=name]', 0); The above fails if the div has more than 1 class. I'm currently working with version 1.7.1 which doesn't have this issue.

It would be nice if you reported a bug here https://sourceforge.net/p/simplehtmldom/bugs/

Thanks m8, I've opened an bug issue: https://sourceforge.net/p/simplehtmldom/bugs/169/

I'll include more details to it as soon as I get a chance 👍

luigitek avatar Apr 11 '19 16:04 luigitek

7.3 compatible version: https://github.com/Kub-AT/php-simple-html-dom-parser

Author of original PHP Simple HTML DOM Parser (sourceforge hosted) did an update on 2018-12-10 (after 6 year ;)) version 1.7 is compatible with PHP 7.3 https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.7/

hi use this https://github.com/Kub-AT/php-simple-html-dom-parser

but i get error Message: Call to undefined method KubAT\PhpSimple\HtmlDomParser::loadFromUrl()

@Kub-AT

derryberni avatar Apr 13 '19 19:04 derryberni

7.3 compatible version: https://github.com/Kub-AT/php-simple-html-dom-parser Author of original PHP Simple HTML DOM Parser (sourceforge hosted) did an update on 2018-12-10 (after 6 year ;)) version 1.7 is compatible with PHP 7.3 https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.7/

hi use this https://github.com/Kub-AT/php-simple-html-dom-parser

but i get error Message: Call to undefined method KubAT\PhpSimple\HtmlDomParser::loadFromUrl()

@Kub-AT

it looks like you have mistaken the library, there is no loadFromUrl in simplehtmldom but is in https://github.com/paquettg/php-html-parser

Kub-AT avatar Apr 15 '19 06:04 Kub-AT

this should be reported in the composer.yml file ! to avoid installation under >= php7.3 (php 7.4 is RC1 now)

ebuildy avatar Sep 11 '19 07:09 ebuildy

@vistart, Get the last version of simplehtmldom from "https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/" site. It will work.

MirolimMajidov avatar Mar 01 '20 04:03 MirolimMajidov

@vistart, Get the last version of simplehtmldom from "https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/" site. It will work.

Thanks this works like charm +1

sandykadam avatar Apr 13 '20 21:04 sandykadam

@vistart, Get the last version of simplehtmldom from "https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.9.1/" site. It will work.

Thank you, it worked for me too.

fehmi avatar Feb 04 '21 10:02 fehmi

7.3 compatible version: https://github.com/Kub-AT/php-simple-html-dom-parser

Author of original PHP Simple HTML DOM Parser (sourceforge hosted) did an update on 2018-12-10 (after 6 year ;)) version 1.7 is compatible with PHP 7.3 https://sourceforge.net/projects/simplehtmldom/files/simplehtmldom/1.7/

How can we install the 1.7 version of the original parser? I'm using laravel and the listed package doesn't contain a composer.json file

serg1uu avatar Jan 22 '22 11:01 serg1uu

@serg1uu I found an alternative, go for https://github.com/simplehtmldom/simplehtmldom

marianoarga avatar Apr 26 '22 18:04 marianoarga