fix audio.add (#1121)

* fix audio.add

* Fix settype to allow Null

* thx celestora <3

* Finaly, Tarhun
This commit is contained in:
Ry0 2024-07-01 22:43:56 +03:00 committed by GitHub
parent 8786bd36fb
commit 9d62bfc12e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -485,7 +485,7 @@ final class Audio extends VKAPIRequestHandler
$this->requireUser(); $this->requireUser();
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
if(!is_null($album_id)) if(!is_null($album_id))
$this->fail(10, "album_id not implemented"); $this->fail(10, "album_id not implemented");
// TODO get rid of dups // TODO get rid of dups

View file

@ -234,8 +234,14 @@ final class VKAPIPresenter extends OpenVKPresenter
} }
try { try {
settype($val, $parameter->getType()->getName()); // Проверка типа параметра
$params[] = $val; $type = $parameter->getType();
if (($type && !$type->isBuiltin()) || is_null($val)) {
$params[] = $val;
} else {
settype($val, $parameter->getType()->getName());
$params[] = $val;
}
} catch (\Throwable $e) { } catch (\Throwable $e) {
// Just ignore the exception, since // Just ignore the exception, since
// some args are intended for internal use // some args are intended for internal use