Re: Patch submission - curl_unescape, curl_strerror, curl_reset, fix for curl_escape
| From: | Adam Kazimierczak | Date: | Fri, 14 Jun 2013 16:01:02 +0000 |
| Subject: | Re: Patch submission - curl_unescape, curl_strerror, curl_reset, fix for curl_escape | ||
| References: | 1 2 3 4 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969384405@lists.php.net to get a copy of this message | ||
On 06/14/2013 02:16 PM, Peter Cowburn wrote:
Hi Adam, On 14 June 2013 10:29, Adam Kazimierczak <kazymjir@gmail.com <mailto:kazymjir@gmail.com>> wrote:Thank you very much for that information, now everything is clear for me.Try running this code: var_dump(curl_escape(0, 'test'), curl_unescape(0, 'test'));Both results are NULL and throws E_WARNINGs: Warning: curl_escape() expects parameter 1 to be resource, integer givenThis falls under the "garbage in, garbage out" rule that we historically don't document. When given incorrect arguments, most PHP functions will return NULL and raise a warning. See the note about this on http://php.net/functions.internal That explains everything. At first I thought that NULL can be the result of incorrect arguments, but I was not sure. I tested this with fseek(0,0) which returned false and that was a thing that had mislead me.
NULL as return on failure is also documented in libcurl docs:
http://curl.haxx.se/libcurl/c/curl_escape.html
If you check php-src, you'll see the functions return FALSE when cURL's curl_easy_(un)escape() returns null.
Yes, I found it. Next time when I will be unsure, I will check php-src.
As I said, they're minor issues and you look to be getting the hang of how things work. I would support giving you commit karma, to be able to push these changes to the docs yourself. Thank you very much.Cheers, Adam