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 bug for PHP latest then 7.2 #86

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
php-simple-html-dom-parser
==========================

Version 1.5.2
Version 1.5.3

Adaptation for Composer and PSR-0 of:

Expand All @@ -20,7 +20,7 @@ Install
composer.phar
```json
"require": {
"sunra/php-simple-html-dom-parser": "1.5.2"
"koshkoshka/php-simple-html-dom-parser": "1.5.3"
}
```

Expand Down
6 changes: 3 additions & 3 deletions Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);}

Expand Down Expand Up @@ -899,7 +899,7 @@ function get_display_size()
{
// Thanks to user gnarf from stackoverflow for this regular expression.
$attributes = array();
preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
preg_match_all("/([\w\-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$attributes[$match[1]] = $match[2];
}
Expand Down Expand Up @@ -1375,7 +1375,7 @@ protected function read_tag()
return true;
}

if (!preg_match("/^[\w-:]+$/", $tag)) {
if (!preg_match("/^[\w\-:]+$/", $tag)) {
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
if ($this->char==='<') {
$this->link_nodes($node, false);
Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"name": "sunra/php-simple-html-dom-parser",
"name": "koshkoshka/php-simple-html-dom-parser",
"type": "library",
"description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.",
"keywords": ["html", "dom", "parser"],
"homepage": "https://github.com/sunra/php-simple-html-dom-parser",
"homepage": "https://github.com/koshkoshka/php-simple-html-dom-parser",
"license": "MIT",
"authors": [
{
"name": "S.C. Chen",
"homepage": "http://sourceforge.net/projects/simplehtmldom/"
},
{
"name": "Andrey Koshkosh",
"homepage": "https://service-kuntsevo.ru"
},
{
"name": "Sunra",
"email": "sunra@yandex.ru",
Expand All @@ -20,6 +24,9 @@
"php": ">=5.3.2",
"ext-mbstring": "*"
},
"replace": {
"sunra/php-simple-html-dom-parser": "*"
},
"autoload": {
"psr-0": { "Sunra\\PhpSimple\\HtmlDomParser": "Src/" }
}
Expand Down