|
@@ -18,7 +18,10 @@ class BencodeDecode extends Bencode {
|
18
|
18
|
* @param bool $IsPath needs to be true if $Arg is a path
|
19
|
19
|
* @return decoded data with a suitable structure
|
20
|
20
|
*/
|
21
|
|
- function __construct($Arg = false, $IsPath = false) {
|
|
21
|
+ function __construct($Arg = false, $IsPath = false, $Strict = true) {
|
|
22
|
+ if (!$Strict) {
|
|
23
|
+ $this->ExitOnError = false;
|
|
24
|
+ }
|
22
|
25
|
if ($Arg === false) {
|
23
|
26
|
if (empty($this->Enc)) {
|
24
|
27
|
return false;
|
|
@@ -169,13 +172,13 @@ class BencodeDecode extends Bencode {
|
169
|
172
|
// The recursive nature of the class requires this to avoid duplicate error messages
|
170
|
173
|
return false;
|
171
|
174
|
}
|
172
|
|
- if ($ErrMsg === false) {
|
173
|
|
- printf("Malformed string. Invalid character at pos 0x%X: %s\n",
|
174
|
|
- $this->Pos, str_replace(array("\r","\n"), array('',' '), htmlentities(substr($this->Data, $this->Pos, self::SnipLength))));
|
175
|
|
- } else {
|
176
|
|
- echo $ErrMsg;
|
177
|
|
- }
|
178
|
175
|
if ($this->ExitOnError) {
|
|
176
|
+ if ($ErrMsg === false) {
|
|
177
|
+ printf("Malformed string. Invalid character at pos 0x%X: %s\n",
|
|
178
|
+ $this->Pos, str_replace(array("\r","\n"), array('',' '), htmlentities(substr($this->Data, $this->Pos, self::SnipLength))));
|
|
179
|
+ } else {
|
|
180
|
+ echo $ErrMsg;
|
|
181
|
+ }
|
179
|
182
|
exit();
|
180
|
183
|
}
|
181
|
184
|
$ErrorPos = $this->Pos;
|