I can't tell you how many hours of my life I've wasted on these kinds of idiotic errors.
I'm basically constructing a URL such as: https://example.com/?test=' . urlencode('meow+foo@gmail.com');
Then, I display it from the URL, like this: echo urldecode($_GET['test']);
And then it shows: meow foo@gmail.com
.
Ugh.
If I instead fo this: echo $_GET['test'];
I get: meow+foo@gmail.com
.
(Naturally, echoing a GET variable like that is insanity, so I would of course do htmlspecialchars
around it in reality. But that's not the point I'm making here.)
So, since browsers (or something) is clearly making this "translation" or "decoding" automatically, doing it again messes it up by removing certain characters, in this case the "+" (plus). Which leads me to believe that I'm not supposed to use urldecode
/rawurldecode
at all.
But then why do they exist?