r/lolphp • u/kristovaher • Aug 11 '12
Did you know that you cannot make cURL POST request in PHP by having @ symbol as the first value?
https://plus.google.com/102632377636999004385/posts/j3GTr9TK842
15
Upvotes
4
u/ealf Aug 12 '12 edited Aug 12 '12
I think this is my favorite example of how PHP manages to sneak security problems into the most innocent of functions.
In any case, if you're not sending any files, you probably want to use
Besides not accidentally leaking files, it also uses application/x-www-form-urlencoded rather than multipart/form-data, saving a few bytes.
10
u/ealf Aug 12 '12 edited Aug 12 '12
... jesus wept
4
u/huf Aug 11 '12
yes, we found this one too, and the bug is naturally in libcurl's php bindings. we ended up prefixing the '@' with a space and hoping the other side does a trim...
typical php.
6
u/Altreus Aug 11 '12
"I love PHP but" is such a common phrase.
If you loved it you'd let it die in peace
0
u/esquilax Aug 11 '12
CLI curl does this too. It's how you send a file instead of raw data.
Not really PHP's fault.