File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ public static function decode($bencoded)
144144 }
145145 elseif (isset ($ current ))
146146 {
147- throw new RuntimeException ('Unexpected value around offset ' . $ pos );
147+ throw new RuntimeException ('Unexpected content ending at offset ' . $ pos );
148148 }
149149 else
150150 {
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ public function getDecodeTests()
119119 'x ' => new ArrayObject (['y ' => 1 ])
120120 ])
121121 ],
122+ [
123+ '3:abc ' ,
124+ 'abc '
125+ ],
122126 ];
123127 }
124128
@@ -187,6 +191,14 @@ public function getDecodeInvalidTests()
187191 'i123 ' ,
188192 new RuntimeException ('Invalid integer end found at offset 4 ' )
189193 ],
194+ [
195+ '3 abc ' ,
196+ new RuntimeException ('Invalid character found at offset 1 ' )
197+ ],
198+ [
199+ '3:abc3:abc ' ,
200+ new RuntimeException ('Unexpected content ending at offset 10 ' )
201+ ],
190202 ];
191203 }
192204}
You can’t perform that action at this time.
0 commit comments