Core: Filter value with "+" not working

Created on 7 Feb 2020  路  4Comments  路  Source: api-platform/core

API Platform version(s) affected: 2.2.0 to 2.5.4

Description
We can't filter with a GET parameter that uses a '+' inside the value. For example an email "[email protected]" or a phone number with the region "+33666666666" will convert the value to ""myemail [email protected]" and "33666666666" because of this line

How to reproduce
Currently, I don't have the time to create a reproducer but you just have to use a GET filter with a '+'

Possible Solution
Don't use the method urldecode that considers the + as a space but I don't fully understand all the logic in this class

bug unconfirmed

Most helpful comment

Are you url-encoding the + character? Otherwise it's normal that it's treated as space.

All 4 comments

This is definitely a bug to me, thanks @FabienSalles for the report. This behavior should be customizable at least.

Are you url-encoding the + character? Otherwise it's normal that it's treated as space.

The "+" wasn't effectively encoded. I found this in my functional test without encoding but now my frontend developer use my endpoint with his form filter, the '+' is correctly encoded in "%2B" and the filter works fine.

So the problem was my test. Sorry, I close this issue.

Could definitely be in the documentation :p

Was this page helpful?
0 / 5 - 0 ratings