bencode
bencode copied to clipboard
zero in int type
https://github.com/rchouinard/bencode/blob/master/src/Decoder.php#L160
i-05e != -5 i05e != 5
Leading zeros are not allowed (although the number zero is still represented as "0").
- add after 140 line:
if ('-' == $this->_getChar($currentOffset) && '0' == $this->_getChar($currentOffset + 1)) {
throw new RuntimeException('Illegal zero-padding found in integer entity at offset ' . $this->_offset);
}
- find:
$absoluteValue = (string) abs($value);
if (1 < strlen($absoluteValue) && "0" == $value[0]) {
replace:
// $absoluteValue = (string) abs($value);
if (1 < strlen($value) && '0' == $value[0]) {