File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
13
13
### Added
14
14
- Added support for PSR7 HTTP clients and requests for URL calls.
15
+ - Added PHAN support and fixed all issues from PHAN.
15
16
16
17
### Changed
17
18
- Fixed issue with \ causing an infite loop.
Original file line number Diff line number Diff line change 1
1
PHP Html Parser
2
2
==========================
3
3
4
- Version 2.2.0
4
+ Version 2.2.1
5
5
6
6
[ ![ Build Status] ( https://travis-ci.org/paquettg/php-html-parser.png )] ( https://travis-ci.org/paquettg/php-html-parser )
7
7
[ ![ Coverage Status] ( https://coveralls.io/repos/paquettg/php-html-parser/badge.png )] ( https://coveralls.io/r/paquettg/php-html-parser )
Original file line number Diff line number Diff line change @@ -615,7 +615,13 @@ protected function parse(): void
615
615
$ this ->root ->setHtmlSpecialCharsDecode ($ this ->options ->htmlSpecialCharsDecode );
616
616
$ activeNode = $ this ->root ;
617
617
while (!\is_null ($ activeNode )) {
618
- $ str = $ this ->content ->copyUntil ('< ' );
618
+ if ($ activeNode && $ activeNode ->tag ->name () === 'script '
619
+ && $ this ->options ->get ('cleanupInput ' ) != true
620
+ ) {
621
+ $ str = $ this ->content ->copyUntil ('</ ' );
622
+ } else {
623
+ $ str = $ this ->content ->copyUntil ('< ' );
624
+ }
619
625
if ($ str == '' ) {
620
626
$ info = $ this ->parseTag ();
621
627
if (!$ info ['status ' ]) {
Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ public function tearDown()
12
12
Mockery::close ();
13
13
}
14
14
15
+ /**
16
+ * <![CDATA[ should not be modified when cleanupInput is set to false
17
+ */
18
+ public function testParsingCData ()
19
+ {
20
+ $ html = "<script type= \"text/javascript \">/* <![CDATA[ */var et_core_api_spam_recaptcha = '';/* ]]> */</script> " ;
21
+ $ dom = new Dom ();
22
+ $ dom ->setOptions (['cleanupInput ' => false ,]);
23
+ $ dom ->load ($ html );
24
+ $ this ->assertSame ($ html , $ dom ->root ->outerHtml ());
25
+ }
26
+
15
27
public function testLoad ()
16
28
{
17
29
$ dom = new Dom ();
You can’t perform that action at this time.
0 commit comments