Cast floats to string for Bencoding.
This commit is contained in:
parent
25063f6b1f
commit
5a1fdccced
2 changed files with 6 additions and 2 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2408.181655
|
||||
0.2408.182001
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// Bencode.php
|
||||
// Created: 2022-01-13
|
||||
// Updated: 2024-08-01
|
||||
// Updated: 2024-08-18
|
||||
|
||||
namespace Index\Bencode;
|
||||
|
||||
|
@ -36,6 +36,10 @@ final class Bencode {
|
|||
case 'string':
|
||||
return sprintf('%d:%s', strlen($value), $value);
|
||||
|
||||
case 'double':
|
||||
$value = (string)$value;
|
||||
return sprintf('%d:%s', strlen($value), $value);
|
||||
|
||||
case 'integer':
|
||||
return sprintf('i%de', $value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue