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

Wrong condition in ParameterExtension #6844

Closed
CvekCoding opened this issue Dec 4, 2024 · 3 comments
Closed

Wrong condition in ParameterExtension #6844

CvekCoding opened this issue Dec 4, 2024 · 3 comments

Comments

@CvekCoding
Copy link
Contributor

API Platform version(s) affected: 4

Description
In ParamaterExtension there is an edge case when we pass "0" in an argument value, which is ok for boolean filter for example.
see

if (!($v = $parameter->getValue()) || $v instanceof ParameterNotFound) {

This condition !($v = $parameter->getValue()) skips the parameter for further processing.

How to reproduce
Use zero as an argument value.

@vinceAmstoutz
Copy link
Contributor

vinceAmstoutz commented Dec 5, 2024

@CvekCoding This issue will be solved in API Platform version 4.1 by this PR #6775

@CvekCoding
Copy link
Contributor Author

@vinceAmstoutz thanks)

@soyuka
Copy link
Member

soyuka commented Dec 8, 2024

we should fix this in lower branches

soyuka added a commit that referenced this issue Dec 9, 2024
soyuka added a commit that referenced this issue Dec 13, 2024
* fix(jsonschema): hashmaps produces invalid openapi schema (#6830)

* fix(jsonschema): hashmaps produces invalid openapi schema

* fix

---------

Co-authored-by: soyuka <[email protected]>

* fix: add missing error normalizer trait and remove deprecated interface (#6853)

* fix: test empty parameter against null (#6852)

fixes #6844

* Fix deprecation symfony/dependency-injection

* cs: run php-cs-fixer

* ci: use problem error normalizer trait

* fix(metadata): various parameter improvements (#6867)


- `Parameter::getValue()` now takes a default value as argument `getValue(mixed $default = new ParameterNotFound()): mixed`
- `Parametes::get(string $key, string $parameterClass = QueryParameter::class)` (but also `has` and `remove`) now has a default value as second argument to `QueryParameter::class`
- Constraint violation had the wrong message when using `property`, fixed by using the `key` instead:

---------

Co-authored-by: Vincent Amstoutz <[email protected]>
Co-authored-by: mladencosa <[email protected]>
Co-authored-by: Michiel Kalle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants