Skip to content

Commit 77de30f

Browse files
committed
Fixed paquettg#179
1 parent 77e4a44 commit 77de30f

File tree

3 files changed

+23
-111
lines changed

3 files changed

+23
-111
lines changed

CHANGELOG.md

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,5 @@
11
### Development
22

3-
## 1.7.0
3+
## 1.2.0
44

5-
- Added .scrutinizer.yml to repo
6-
- Reformated code to PSR-1/2
7-
- Improved the test coverage and some small code changes
8-
- Added removeAttribute and removeAllAttributes tag methods fixes #57
9-
- Added replaceNode method implements #52
10-
- Added a delete method. fixes #43
11-
- Added semicolon after &#10 for linebreak preservation. fixes #62
12-
- Removed code that removed <code> tag fixes #60
13-
- Added new test related to #63
14-
- Refactored the nodes into inner and leaf nodes
15-
- Fixed Strings example in README
16-
- Close this header so the markdown will render properly
17-
- Added preserve line break option. Defaults to false.
18-
19-
20-
## 1.6.9
21-
22-
- Added Changelog
23-
- Fixed issue with spaces befor closing tag Fixes #45
24-
- Fixed some code quality issues found by scrutinizer
25-
- Added Scrutinizer to README
26-
- Reformated code to comply with PSR-1/2
27-
- Added preserve line break option. Defaults to false. fixes #40
28-
- Updated the tests
29-
- Added options: cleanupInput, removeScripts and removeStyles
30-
31-
## 1.6.8
32-
33-
- Added comments and reformated some code
34-
- Added support for non-escaped quotes in attribute value fixes #37
35-
- Cleaned up the comments and php docs
36-
- Removed version in composer json
37-
- Updated composer version
38-
- Refactoring out isChild method.
39-
- Updated in code documentation
40-
- Updated composer
41-
42-
$$ 1.6.7
43-
44-
- Added tests for the new array access
45-
- Added feature to allow array usage of html node. fixes #26
46-
- Update HtmlNode.php
47-
- Added test to cover issue #28
48-
- FIX: File name is longer than the maximum allowed path
49-
50-
## 1.6.6
51-
52-
- Replaced preg_replace with mb_ereg_replace
53-
- Added child selector fixes #24
54-
- Updated the dev version of phpunit
55-
56-
## 1.6.5
57-
58-
- Fixed bug when no attribute tags are last tag (with out space). fixes #16
59-
- Fixed some documentation inconsistencies fixes #15
60-
- Made loadStr a public methor Fixes #18
61-
- Update a problem with the README fixes #11
62-
- Added setAttribute to the node fixes #7
63-
- Check if open_basedir is enabled: Dont use CURLOPT_FOLLOWLOCATION
64-
65-
## 1.6.4
66-
67-
- Added tests and updated README
68-
- Updated the tests and moved some files
69-
- Added the option to enforce the encoding
70-
- Fixed a problem with handeling the unknown child exception
71-
- Updated some tests
72-
- Added coverall badge and package
73-
74-
## 1.6.3
75-
76-
- Added initial support for 'strict' parsing option
77-
- Added an optional paramter to enable recursive text
78-
- Added appropriat Options tests
79-
- Changed all exception to specific objects
80-
- Added a whitespaceTextNode option and test
81-
- Added support for an options array
82-
83-
## 1.6.2
84-
85-
- Standardised indentation for easyer reading on github
86-
- Update AbstractNode.php
87-
- Added a test for hhvm in my travis.yml
88-
- Added a LICENSE.md file for MIT
89-
- Added build status to README
90-
- Added travis.yml
91-
- Changed the file name of the abstract node
92-
- fixed code in collection class where instance of arrayIterator is to be rturned
93-
- Updated documentation
94-
- Added a curl interface and a simple curl class.
95-
- Removed the Guzzle dependancy
96-
- Abstracted the Node class as it should have been done in the first place
97-
- Added integrity checks for the cached html
98-
- Added some basic caching of the dom html
99-
- Added a toArray() method to the collection and a test
100-
101-
## 1.6.1
102-
103-
- Moved back to using guzzle so expections are thrown when their was an error with loading a url
104-
- Added tests for the Static Facade Fixed a few issues brought to light from the new tests
105-
- Added a static facade
106-
- Changed encoding to be a local attribute instead of a static attribute
107-
- Solved issue #2 When you attempt to load an html page from a URL using loadFromUrl the encoding is incorrect.
108-
- Added easyer loading of files and urls. Still have a problem with encoding while loading from url.
109-
- Added guzzle and loadFromUrl option
110-
- Fixed an issue with no value attributes
111-
- Added magic and each methods to the collection. Plus some tests
112-
- Added a collection object
113-
- Added charset encoding
114-
- fixed a bug with closing tags If a closing tag did not have an opening tag it would cause the scan to end instead of ignoring the closing tag.
5+
- Fixed bug that caused an infinite loop when no content found in tags.

src/PHPHtmlParser/Dom.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,11 @@ protected function parseTag(): array
626626
}
627627

628628
$tag = strtolower($this->content->copyByToken('slash', true));
629+
if (trim($tag) == '')
630+
{
631+
// no tag found, invalide < found
632+
return $return;
633+
}
629634
$node = new HtmlNode($tag);
630635

631636
// attributes

tests/DomTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,4 +414,20 @@ public function testGetChildrenNoChildren()
414414
$children = $imgNode->getChildren();
415415
$this->assertTrue(count($children) === 0);
416416
}
417+
418+
public function testInfiniteLoopNotHappening()
419+
{
420+
$dom = new Dom();
421+
$dom->loadStr('<html>
422+
<head>
423+
<meta http-equiv="refresh" content="5; URL=http://www.example.com">
424+
<meta http-equiv="cache-control" content="no-cache">
425+
<meta http-equiv="pragma" content="no-cache">
426+
<meta http-equiv="expires" content="0">
427+
</head>
428+
<');
429+
430+
$metaNodes = $dom->root->find('meta');
431+
$this->assertEquals(4, count($metaNodes));
432+
}
417433
}

0 commit comments

Comments
 (0)