Re: Patch submission - curl_unescape, curl_strerror, curl_reset, fix for curl_escape
| From: | Peter Cowburn | Date: | Fri, 14 Jun 2013 12:16:26 +0000 |
| Subject: | Re: Patch submission - curl_unescape, curl_strerror, curl_reset, fix for curl_escape | ||
| References: | 1 2 3 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969384404@lists.php.net to get a copy of this message | ||
Hi Adam,
On 14 June 2013 10:29, Adam Kazimierczak <kazymjir@gmail.com> wrote:
>
> 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 given
>
This 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
NULL as return on failure is also documented in libcurl docs:
>
> http://curl.haxx.se/libcurl/c/**curl_escape.html<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.
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.
Cheers,
Peter