[php] Fix file uploads by backporting #21458 (#21632)

* [php] Backport #21458 to php client

Fixes #21485

Credits to @jozefbriss

* [php] Fix deprecation warning when running integration tests

OpenAPI\Client\FakeHttpClient::setResponse(): Implicitly marking parameter $response as nullable is deprecated, the explicit nullable type must be used instead

---------

Co-authored-by: simonhammes <simonhammes@users.noreply.github.com>
This commit is contained in:
Simon 2025-07-28 10:58:03 +02:00 committed by GitHub
parent 7d3913f1dd
commit d69714f197
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View File

@ -113,8 +113,12 @@ class FormDataProcessor
$currentName .= $currentSuffix; $currentName .= $currentSuffix;
} }
if (is_resource($val)) {
$result[$currentName] = $val;
} else {
$result[$currentName] = ObjectSerializer::toString($val); $result[$currentName] = ObjectSerializer::toString($val);
} }
}
$currentName = $start; $currentName = $start;
} }

View File

@ -121,8 +121,12 @@ class FormDataProcessor
$currentName .= $currentSuffix; $currentName .= $currentSuffix;
} }
if (is_resource($val)) {
$result[$currentName] = $val;
} else {
$result[$currentName] = ObjectSerializer::toString($val); $result[$currentName] = ObjectSerializer::toString($val);
} }
}
$currentName = $start; $currentName = $start;
} }

View File

@ -27,7 +27,7 @@ class FakeHttpClient implements ClientInterface
/** /**
* @param null|ResponseInterface $response * @param null|ResponseInterface $response
*/ */
public function setResponse(ResponseInterface $response = null) public function setResponse(?ResponseInterface $response = null)
{ {
$this->response = $response; $this->response = $response;
} }

View File

@ -121,8 +121,12 @@ class FormDataProcessor
$currentName .= $currentSuffix; $currentName .= $currentSuffix;
} }
if (is_resource($val)) {
$result[$currentName] = $val;
} else {
$result[$currentName] = ObjectSerializer::toString($val); $result[$currentName] = ObjectSerializer::toString($val);
} }
}
$currentName = $start; $currentName = $start;
} }