File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -623,7 +623,13 @@ protected function parse(): void
623
623
$ this ->root ->setHtmlSpecialCharsDecode ($ this ->options ->htmlSpecialCharsDecode );
624
624
$ activeNode = $ this ->root ;
625
625
while ( ! is_null ($ activeNode )) {
626
- $ str = $ this ->content ->copyUntil ('< ' );
626
+ if ($ activeNode && $ activeNode ->tag ->name () === 'script '
627
+ && $ this ->options ->get ('cleanupInput ' ) != true
628
+ ) {
629
+ $ str = $ this ->content ->copyUntil ('</ ' );
630
+ } else {
631
+ $ str = $ this ->content ->copyUntil ('< ' );
632
+ }
627
633
if ($ str == '' ) {
628
634
$ info = $ this ->parseTag ();
629
635
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