Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #10817
Closed
Open
Issue created Nov 09, 2021 by Administrator@rootContributor

[BUG][PHP] ObjectSerializer.php throws ValueError when handling \SplFileObject type

Created by: robertsjumis

@wing328

Description

/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php

ObjectSerializer.php throws ValueError when handling \SplFileObject type @ line 336. This is because SplFileObject can be passed to settype(), which then throws the said error.

There is no reason to handle 'object', 'mixed', '\DateTime' in line 336, because they're handled before.

Also - there is no reason for line 336 to handle '\SplFileObject', because this specific object type is handled below.

The said object types should be deleted from the array.

openapi-generator version

5.3.0. - 6.0.0.

OpenAPI declaration file content or url

.../samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php

Line 336

Generation Details

php client

Steps to reproduce
  1. Find an endpoint that returns a PDF file.
  2. Generate PHP client that makes a GET request to the said endpoint.
  3. Use client to call the endpoint.
Related issues/PRs
Suggest a fix

replace line 336 with: if (in_array($class, ['array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'number', 'string', 'void'], true)) {

Assignee
Assign to
Time tracking