Better errors
This commit is contained in:
parent
e1ca8b612c
commit
058e8ca7e9
|
@ -294,6 +294,10 @@ trait TL
|
||||||
case 'double':
|
case 'double':
|
||||||
return $this->pack_double($object);
|
return $this->pack_double($object);
|
||||||
case 'string':
|
case 'string':
|
||||||
|
if (!is_string($object)) {
|
||||||
|
throw new Exception("You didn't provide a valid string");
|
||||||
|
}
|
||||||
|
|
||||||
$object = pack('C*', ...unpack('C*', $object));
|
$object = pack('C*', ...unpack('C*', $object));
|
||||||
$l = strlen($object);
|
$l = strlen($object);
|
||||||
$concat = '';
|
$concat = '';
|
||||||
|
@ -310,6 +314,9 @@ trait TL
|
||||||
|
|
||||||
return $concat;
|
return $concat;
|
||||||
case 'bytes':
|
case 'bytes':
|
||||||
|
if (!is_string($object) && !($object instanceof \danog\MadelineProto\TL\Bytes)) {
|
||||||
|
throw new Exception("You didn't provide a valid string");
|
||||||
|
}
|
||||||
$l = strlen($object);
|
$l = strlen($object);
|
||||||
$concat = '';
|
$concat = '';
|
||||||
if ($l <= 253) {
|
if ($l <= 253) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user