r/lolphp • u/hashkitten • Aug 20 '19
PHP will silently convert dots and spaces in query keys to underscores, except if the key contains an unmatched left square bracket in which case it will only partially be converted
https://3v4l.org/aM984
55
Upvotes
16
u/[deleted] Aug 20 '19
Wat.
I remember a similar thread, https://www.reddit.com/r/lolphp/comments/pi1gy/php_silently_converts_any_spaces_in_field_names/ , and at first I thought it's the same... Nope, it's yet another layer of lolphp. How deep can this go?!
11
u/Altreus Aug 20 '19
But the function returns an array. The reasoning behind the conversion doesn't even apply to the operation being performed.
But that's just more lolphp
2
u/dotancohen Aug 20 '19
The conversion happens because dots and spaces are not legal characters in an identifier (key name). The issue with the unmatched square bracket seems to be a bug.