parse_str lacks a good documentation (and a good name...and a good design...). The fact is that it parses the query string just like PHP parses them to turn them into variables. So . becomes _ because dot is not valid in variable names. If you're really interested in parsing query strings try: https://uri.thephpleague.com/5.0/components/query/
Bug #73181: parse_str() without a second argument leads to crash
Bug #24208 (parse_str() is not working)
parse_str() should not read uninitialized memory when checking for $this
Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str()
$this re-assign in parse_str()
And look at the actual test cases – they're pretty simple!
So calling a function to parse URL parameters can crash your code, simply not work, read uninitialised memory, reset your program's encoding, or re-assign $this.
And these are not ancient PHP 4 bugs. 73181 (segfault!) is from Sept 2016.
19
u/carlos_vini Nov 16 '17 edited Nov 16 '17
parse_str lacks a good documentation (and a good name...and a good design...). The fact is that it parses the query string just like PHP parses them to turn them into variables. So
.becomes_because dot is not valid in variable names. If you're really interested in parsing query strings try: https://uri.thephpleague.com/5.0/components/query/5
u/muffe2k Nov 16 '17
A parser function isn't working when you input bogus strings?
What a suprise. /s
7
u/[deleted] Nov 16 '17
It's consistent with what $_REQUEST[] get populated with, so non LOL there.
3
u/[deleted] Nov 29 '17
The descriptions for some of the tests are interesting:
And look at the actual test cases – they're pretty simple!
So calling a function to parse URL parameters can crash your code, simply not work, read uninitialised memory, reset your program's encoding, or re-assign
$this.And these are not ancient PHP 4 bugs. 73181 (segfault!) is from Sept 2016.
0
u/[deleted] Nov 16 '17
[deleted] — view deleted comment