Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regex character class order in simple_html_dom.php #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

munkiepus
Copy link

The order of the dashes in character classes is affected by later versions of PHP, changing the order of the character ranges fixes the problem, have shortcodes after any dashes.

I noticed when upgrading to 7.4.3

the problem is explained here
https://stackoverflow.com/a/24767090/2831388

causes a couple of errors:
Compilation failed: invalid range in character class at offset 4 in simple_html_dom.php on line 1378

and a similar error on line 696

@@ -693,7 +693,7 @@ protected function parse_selector($selector_string) {
// This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression.
// farther study is required to determine of this should be documented or removed.
// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
$pattern = "/([-:\*\w]*)(?:\#([-\w]+)|\.([-\w]+))?(?:\[@?(!?[-\w:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You gonna get an error without ; at the end of line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants