Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of non type-safe comparison operator causing problems in PHP template #224

Closed
dylangleason opened this issue Jul 25, 2014 · 0 comments
Closed
Milestone

Comments

@dylangleason
Copy link

I ran into this issue running unit tests against my API - using the loosely-typed comparison opereator != resulted in some weird behavior:

if($offset != null) {
            $queryParams['offset'] = $this->apiClient->toQueryValue($offset);
}

The problem here is that the $offset can have a value of 0, but this check will skip quoting of this value.

This resulted in the API call failing on a SQL statement that instead inserted NULL as the quoted value.

Is there any reason why the template doesn't use the safe comparison operator? See:

https://github.com/wordnik/swagger-codegen/blob/master/src/main/resources/php/api.mustache

@fehguy fehguy added this to the v2.1.0-M1 milestone Dec 24, 2014
fehguy added a commit that referenced this issue Feb 17, 2015
@fehguy fehguy closed this as completed Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants