Skip to content

Commit

Permalink
fix audio.add (#1121)
Browse files Browse the repository at this point in the history
* fix audio.add

* Fix settype to allow Null

* thx celestora <3

* Finaly, Tarhun
  • Loading branch information
xRy0 committed Jul 1, 2024
1 parent 8786bd3 commit 9d62bfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VKAPI/Handlers/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ function add(int $audio_id, int $owner_id, ?int $group_id = NULL, ?int $album_id
$this->requireUser();
$this->willExecuteWriteAction();

if(!is_null($album_id))
if(!is_null($album_id))
$this->fail(10, "album_id not implemented");

// TODO get rid of dups
Expand Down
10 changes: 8 additions & 2 deletions Web/Presenters/VKAPIPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,14 @@ function renderRoute(string $object, string $method): void
}

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) {
// Just ignore the exception, since
// some args are intended for internal use
Expand Down

0 comments on commit 9d62bfc

Please sign in to comment.