php-nextgen - Fix flatten() to support arrays of files#21458
Merged
wing328 merged 3 commits intoOpenAPITools:masterfrom Jul 2, 2025
Merged
php-nextgen - Fix flatten() to support arrays of files#21458wing328 merged 3 commits intoOpenAPITools:masterfrom
wing328 merged 3 commits intoOpenAPITools:masterfrom
Conversation
…orm-data Previously, FormDataProcessor::flatten() unconditionally passed all values through ObjectSerializer::toString(), which caused an error when flattening arrays containing file resources (e.g. for OpenAPI multipart/form-data definitions with `type: array`, `items: type: string, format: binary`). This change adds a check for is_resource() to preserve stream handles without serialization, ensuring correct behavior when uploading multiple files in a single request.
Member
|
thanks for the pr please follow step 3 to update the samples |
Member
|
thanks again for the fix is it correct to say that you've been using this fix and confirm it's working as expected ? |
Contributor
Author
|
Yes, after this edit, the Thank you for guiding me. |
Member
|
thanks for the PR let's give it a try |
simonhammes
added a commit
to simonhammes/openapi-generator
that referenced
this pull request
Jul 25, 2025
Fixes OpenAPITools#21485 Credits to @jozefbriss
5 tasks
wing328
pushed a commit
that referenced
this pull request
Jul 28, 2025
* [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>
Goopher
pushed a commit
to Goopher/openapi-generator
that referenced
this pull request
Sep 9, 2025
…s#21632) * [php] Backport OpenAPITools#21458 to php client Fixes OpenAPITools#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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
FormDataProcessor::flatten()unconditionally passed all values throughObjectSerializer::toString(), which caused an error when flattening arrays containing file resources (e.g. for OpenAPI multipart/form-data definitions withtype: string, format: binary).This change adds a check for is_resource() to preserve stream handles without serialization, ensuring correct behavior when uploading files.
The error is not in generator itself but rather in the generated utility PHP class FormDataProcessor.php
Reproducible by generating method that utilizes any file or file list. For example:
@renepardon