php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15150 curl_errno() [still] reports strange numbers
Submitted: 2002-01-21 10:45 UTC Modified: 2002-04-03 19:13 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alberto at urizen dot it Assigned:
Status: Closed Package: cURL related
PHP Version: 4.1.1 OS: linux 2.4.16
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alberto at urizen dot it
New email:
PHP Version: OS:

 

 [2002-01-21 10:45 UTC] alberto at urizen dot it
curl_errno() returns strange wrong values (very large numbers.. negative
numbers etc..)

$ch = curl_init ("http://www.php.net");
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_HEADER, 0);
$page=curl_exec ($ch);
$errore=curl_errno($ch);
error_log (" curl_errno: $errore",0);
curl_close ($ch);

my configure options:
'./configure' '--enable-trans-sid' '--with-mm=/usr/local/src/mm-1.1.3' '--with-mhash'                            '--with-apxs=/var/lib/apache/sbin/apxs'
'--with-mysql' '--with-curl'

libcurl version is libcurl 7.9.2 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-03 08:18 UTC] daniel at haxx dot se
I'd suggest a patch similar to this one. This was made against the current CVS.

diff -u -r1.110 curl.c
--- curl.c      24 Mar 2002 10:40:21 -0000      1.110
+++ curl.c      3 Apr 2002 13:18:14 -0000
@@ -797,8 +797,8 @@
                                }
                        }
 
+            SAVE_CURL_ERROR(ch, error);
                        if (error != CURLE_OK) {
-                               SAVE_CURL_ERROR(ch, error);
                                RETURN_FALSE;
                        }
 
@@ -857,8 +857,8 @@
        }
        }
 
+    SAVE_CURL_ERROR(ch, error);
        if (error != CURLE_OK) {
-               SAVE_CURL_ERROR(ch, error);
                RETURN_FALSE;
        } else {
                RETURN_TRUE;
@@ -881,10 +881,10 @@
        ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
 
        error = curl_easy_perform(ch->cp);
+    SAVE_CURL_ERROR(ch, error);
        if (error != CURLE_OK) {
                if (ch->handlers->write->buf.len > 0)
                        smart_str_free(&ch->handlers->write->buf);
-               SAVE_CURL_ERROR(ch, error);
                RETURN_FALSE;
        }
 [2002-04-03 19:13 UTC] sterling@php.net
Fixed in CVS, thanks to both of you.
 [2002-09-09 08:21 UTC] mix77 at webmail dot co dot za
OS Redhat 7.3 - 2.4.18-10 (updated)
PHP 4.1.2 (updated)

With this line included:
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

the function,
   curl_errno($ch);

returns '768' when connection is made successfully. Without
the line, 0 is returned.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 04:01:28 2024 UTC