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
1212
1313### Added
1414- Added support for PSR7 HTTP clients and requests for URL calls.
15+ - Added PHAN support and fixed all issues from PHAN.
1516
1617### Changed
1718- Fixed issue with \ causing an infite loop.
Original file line number Diff line number Diff line change 11PHP Html Parser
22==========================
33
4- Version 2.2.0
4+ Version 2.2.1
55
66[ ![ Build Status] ( https://travis-ci.org/paquettg/php-html-parser.png )] ( https://travis-ci.org/paquettg/php-html-parser )
77[ ![ 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
615615 $ this ->root ->setHtmlSpecialCharsDecode ($ this ->options ->htmlSpecialCharsDecode );
616616 $ activeNode = $ this ->root ;
617617 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+ }
619625 if ($ str == '' ) {
620626 $ info = $ this ->parseTag ();
621627 if (!$ info ['status ' ]) {
Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ public function tearDown()
1212 Mockery::close ();
1313 }
1414
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+
1527 public function testLoad ()
1628 {
1729 $ dom = new Dom ();
You can’t perform that action at this time.
0 commit comments