File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Changed
11+ - Fixed issue with \ causing an infite loop.
12+
13+ ## 2.2.0
14+
1015### Added
1116- Added support for php 7.4.
1217- Added custom header support for curl request.
Original file line number Diff line number Diff line change @@ -708,7 +708,7 @@ protected function parseTag(): array
708708 case '" ' :
709709 $ attr ['doubleQuote ' ] = true ;
710710 $ this ->content ->fastForward (1 );
711- $ string = $ this ->content ->copyUntil ('" ' , true , true );
711+ $ string = $ this ->content ->copyUntil ('" ' , true );
712712 do {
713713 $ moreString = $ this ->content ->copyUntilUnless ('" ' , '=> ' );
714714 $ string .= $ moreString ;
@@ -720,7 +720,7 @@ protected function parseTag(): array
720720 case "' " :
721721 $ attr ['doubleQuote ' ] = false ;
722722 $ this ->content ->fastForward (1 );
723- $ string = $ this ->content ->copyUntil ("' " , true , true );
723+ $ string = $ this ->content ->copyUntil ("' " , true );
724724 do {
725725 $ moreString = $ this ->content ->copyUntilUnless ("' " , '=> ' );
726726 $ string .= $ moreString ;
Original file line number Diff line number Diff line change @@ -142,6 +142,13 @@ public function testLoadNoValueAttribute()
142142 $ this ->assertEquals ('<div class="content"><div class="grid-container" ui-view>Main content here</div></div> ' , $ dom ->innerHtml );
143143 }
144144
145+ public function testLoadBackslashAttributeValue ()
146+ {
147+ $ dom = new Dom ;
148+ $ dom ->load ('<div class="content"><div id="\" class="grid-container" ui-view>Main content here</div></div> ' );
149+ $ this ->assertEquals ('<div class="content"><div id="\" class="grid-container" ui-view>Main content here</div></div> ' , $ dom ->innerHtml );
150+ }
151+
145152 public function testLoadNoValueAttributeBefore ()
146153 {
147154 $ dom = new Dom ;
@@ -504,4 +511,13 @@ public function testMultipleSquareSelector()
504511 $ items = $ dom ->find ('input[type=text][name=foo][baz=fig] ' );
505512 $ this ->assertEquals (1 , count ($ items ));
506513 }
514+
515+ public function testLoadGetAttributeWithBackslash ()
516+ {
517+ $ dom = new Dom ();
518+ $ dom ->load ('<div><a href="/test/"><img alt="\" src="/img/test.png" /><br /></a><a href="/demo/"><img alt="demo" src="/img/demo.png" /></a></div> ' );
519+ $ imgs = $ dom ->find ('img ' , 0 );
520+ $ this ->assertEquals ("/img/test.png " , $ imgs ->getAttribute ('src ' ));
521+
522+ }
507523}
You can’t perform that action at this time.
0 commit comments