Skip to content

Commit

Permalink
prevent overwrting args by using cloned obj, fixes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Jun 12, 2024
1 parent f1227e5 commit 0560152
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/OpencastApi/Rest/OcRestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ public function hasVersion($version)
{
if (empty($this->version)) {
try {
$defaultVersion = $this->performGet('/api/version/default');
// We have to use and aux object, in order to prevent overwriting arguments of current object.
$aux = clone $this;
$defaultVersion = $aux->performGet('/api/version/default');
if (!empty($defaultVersion['body']) && isset($defaultVersion['body']->default)) {
$this->setVersion(str_replace(['application/', 'v', '+json'], ['', '', ''], $defaultVersion['body']->default));
} else {
Expand Down

0 comments on commit 0560152

Please sign in to comment.