php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52448 ext/curl/tests/curl_error_basic.phpt fail
Submitted: 2010-07-26 20:03 UTC Modified: 2011-11-05 20:47 UTC
From: glen at delfi dot ee Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.3.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: glen at delfi dot ee
New email:
PHP Version: OS:

 

 [2010-07-26 20:03 UTC] glen at delfi dot ee
Description:
------------
the curl library error string has changed, trivial patch fixes that

tested with curl version = 7.21.0


========DIFF========
002+ Error: Could not resolve host: fakeURL (Domain name not found)
002- Error: Couldn't resolve host 'fakeURL'


Test script:
---------------
$ TEST_PHP_EXECUTABLE=$(which php) php run-tests.php --show-all ext/curl/tests/curl_error_basic.phpt

=====================================================================
PHP         : /usr/bin/php
PHP_SAPI    : cli
PHP_VERSION : 5.3.3
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux carme-pld-i686 2.6.34.1-3 #1 SMP Tue Jul 6 16:15:11 CEST 2010 i686
INI actual  : /etc/php/php-cli.ini
More .INIs  : /etc/php/conf.d/PCRE.ini,/etc/php/conf.d/SPL.ini,/etc/php/conf.d/bcmath.ini,/etc/php/conf.d/bz2.ini,/etc/php/conf.d/calendar.ini,/etc/php/conf.d/ctype.ini,/etc/php/conf.d/curl.ini,/etc/php/conf.d/dba.ini,/etc/php/conf.d/dom.ini,/etc/php/conf.d/ftp.ini,/etc/php/conf.d/gd.ini,/etc/php/conf.d/gettext.ini,/etc/php/conf.d/iconv.ini,/etc/php/conf.d/imap.ini,/etc/php/conf.d/ldap.ini,/etc/php/conf.d/mbstring.ini,/etc/php/conf.d/mcrypt.ini,/etc/php/conf.d/mysql.ini,/etc/php/conf.d/openssl.ini,/etc/php/conf.d/pgsql.ini,/etc/php/conf.d/posix.ini,/etc/php/conf.d/simplexml.ini,/etc/php/conf.d/soap.ini,/etc/php/conf.d/sockets.ini,/etc/php/conf.d/tidy.ini,/etc/php/conf.d/xml.ini,/etc/php/conf.d/xmlrpc.ini,/etc/php/conf.d/zlib.ini
CWD         : /home/users/glen/rpm/BUILD.i686-linux/php-5.3.3
Extra dirs  :
VALGRIND    : Not used
=====================================================================
Running selected tests.
TEST 1/1 [ext/curl/tests/curl_error_basic.phpt]
========SKIP========
<?php if (!extension_loaded("curl")) print "skip"; ?>
========DONE========

========TEST========
<?php
/*
 * Prototype:     string curl_error(resource $ch)
 * Description:   Returns a clear text error message for the last cURL operation.
 * Source:        ext/curl/interface.c
 * Documentation: http://wiki.php.net/qa/temp/ext/curl
 */

// Fake URL to trigger an error
$url = "fakeURL";

echo "== Testing curl_error with a fake URL ==\n";

// cURL handler
$ch = curl_init($url);

ob_start(); // start output buffering
curl_exec($ch);
echo "Error: " . curl_error($ch);
curl_close($ch);

?>
========DONE========

========OUT========
== Testing curl_error with a fake URL ==
Error: Could not resolve host: fakeURL (Domain name not found)
========DONE========

========EXP========
== Testing curl_error with a fake URL ==
Error: Couldn't resolve host 'fakeURL'
========DONE========

========DIFF========
002+ Error: Could not resolve host: fakeURL (Domain name not found)
002- Error: Couldn't resolve host 'fakeURL'
========DONE========
FAIL curl_error() function - basic test for curl_error using a fake url [ext/curl/tests/curl_error_basic.phpt]
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
curl_error() function - basic test for curl_error using a fake url [ext/curl/tests/curl_error_basic.phpt]
=====================================================================



Patches

bug-52448.patch (last revision 2010-07-26 18:04 UTC by glen at delfi dot ee)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-27 04:34 UTC] srinatar@php.net
pl. look at the test script carefully. there is instruction on how to run this test script and also available at http://wiki.php.net/qa/temp/ext/curl

if this convinces u ,pl. move this bug to bogus.
 [2010-07-27 10:09 UTC] glen at delfi dot ee
this concrete test test for library error code when trying to connect to 
unresolvable host. plz look the test code.

and library error string pattern has changed, so either it must be updated (like 
i suggested a patch), or make it support various error formats.

i.e the link you gave suggested how to setup webserver for tests, but this test 
does not connect to test webserver!
 [2010-07-27 10:15 UTC] glen at delfi dot ee
to further illustrate that the error cames from curl library and is dependant on 
curl library version:

$ curl fakeURL
curl: (6) Couldn't resolve host 'fakeURL'
$ curl --version
curl 7.18.2 (i686-pld-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7m zlib/1.2.4 
libidn/1.10 libssh2/0.18
Protocols: tftp  ftp telnet dict ldap http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 

$ curl fakeURL
curl: (6) Could not resolve host: fakeURL (Domain name not found)
$ curl --version
curl 7.21.0 (x86_64-pld-linux-gnu) libcurl/7.21.0 GnuTLS/2.10.0 zlib/1.2.5 c-
ares/1.6.0 libidn/1.19 libssh2/1.2.5 librtmp/2.2e
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtmp 
rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
 [2010-12-20 12:07 UTC] jani@php.net
-Package: Tidy +Package: cURL related
 [2011-03-21 12:28 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-03-21 12:28 UTC] cataphract@php.net
Assuming it is already fixed as nothing shows up in http://gcov.php.net/viewer.php?version=PHP_5_3&func=tests.
 [2011-08-23 07:01 UTC] glen at delfi dot ee
nothing is fixed, the patch i proposed still can be applied

and if you looked at the bugreport, the error is dependant on curl library 
version, so if you want to depend on curl library output strings, you should be 
handling different curl version outputs

please DO READ the previous notes what the bug is about, DO READ the proposed 
patch

yet here i can't unmark "bogus" of the bug
 [2011-11-05 20:47 UTC] glen at delfi dot ee
-Operating System: PLD Linux +Operating System:
 [2011-11-05 20:47 UTC] glen at delfi dot ee
ok, seems somebody finally wake up and commited the fix:

http://svn.php.net/viewvc/php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt?
r1=296679&r2=315940
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 13:01:34 2019 UTC