php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47717 Curl error: <url> malformed
Submitted: 2009-03-19 13:28 UTC Modified: 2009-05-03 15:52 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: ray_kimsey at ncsu dot edu Assigned: pajoye (profile)
Status: Not a bug Package: cURL related
PHP Version: 5.2CVS-2009-03-18 OS: RHEL 5.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ray_kimsey at ncsu dot edu
New email:
PHP Version: OS:

 

 [2009-03-19 13:28 UTC] ray_kimsey at ncsu dot edu
Description:
------------
Compiled current production PHP 5.2.9 (and with CVS version php5.2-200903181530) with Curl 7.19.4 (x86_64) using code below fails:

Compiled PHP 5.2.6 against Curl 7.19.4 works as expected.

Compiled php5.2-200903181530 compiled against RHEL curl 7.15.5 (x86_64) works as expected.

Reproduce code:
---------------
<?php

$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/');
curl_setopt($ch, CURLOPT_URL, 'http://newton.ces.ncsu.edu/');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

if (curl_exec($ch) === false) {
        echo 'Curl error: ' . curl_error($ch) . "\n";
}
curl_close($ch);
?>




Expected result:
----------------
$ php t.php
* About to connect() to newton.ces.ncsu.edu port 80
*   Trying 152.1.215.211... * connected
* Connected to newton.ces.ncsu.edu (152.1.215.211) port 80
> GET / HTTP/1.1
Host: newton.ces.ncsu.edu
Accept: */*

< HTTP/1.1 200 OK
< Date: Thu, 19 Mar 2009 13:20:25 GMT
< Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8j DAV/2 PHP/5.2.10-dev SVN/1.5.4
< Last-Modified: Mon, 23 Jan 2006 12:53:15 GMT
< ETag: "10486c8-3d-40b061d3ba4c0"
< Accept-Ranges: bytes
< Content-Length: 61
< Content-Type: text/html
* Connection #0 to host newton.ces.ncsu.edu left intact
* Closing connection #0


Actual result:
--------------
$php t.php
* <url> malformed
Curl error: <url> malformed


if you exchange newton.ces.ncsu.edu with www.google.com you get:

php t.php
* Input domain encoded as `UTF-8'
* getaddrinfo(3) failed for xn--6l4d:80
* Couldn't resolve host ?'
* Closing connection #0
Curl error: Couldn't resolve host ?'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-20 14:55 UTC] codeslinger at compsalot dot com
in bug #47616  the problem turned out to be incorrect passing of the parameters.  This bug may be related.
 [2009-04-01 11:42 UTC] jani@php.net
If it works with older Curl version but not the new one, how is this 
PHP bug?
 [2009-04-01 11:58 UTC] ray_kimsey at ncsu dot edu
Well PHP 5.2.6 works with older and newer versions of Curl. (see orignal description of problem). 

There appears to be something that was implemented in newer versions of PHP (later than 5.2.6) that is causing a problem.  My guess would be something new (such as COPYPOSTFIELDS) implemented in recent versions of Curl that newer versions of PHP are trying to use.
 [2009-04-01 12:00 UTC] pajoye@php.net
Summary:
5.2.9 + 7.19.4, x64, fails.
5.2.6 + 7.19.4, x64, works.
snaps 5.2-20090318153 + 7.19.4 x64, fails.
snaps 5.2-20090318153 + 7.15.5 x64, works.

Do I get it right?

 [2009-04-01 12:03 UTC] ray_kimsey at ncsu dot edu
Yes, that is correct.
 [2009-04-01 12:34 UTC] pajoye@php.net
It works here. Maybe some invalid redirect from one of your box? Did you try this script from the same machine or network?

5.3.0-cvs, 5.2.9-1 and 5.2-cvs with curl 7.19.4:

* About to connect() to www.google.com port 80 (#0)
*   Trying 74.125.39.99... * connected
* Connected to www.google.com (74.125.39.99) port 80 (#0)
> GET / HTTP/1.1
Host: www.google.com
Accept: */*

< HTTP/1.1 302 Found
< Location: http://www.google.de/
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< Server: GoogleOS 1.0
< Set-Cookie: PREF=ID=4a339d976374a632:TM=1238589105:LM=1238589105:S=7pLUEtWGxnkHF5G4; expires=Fri, 01-Apr-2011 12:31:45
 GMT; path=/; domain=.google.com
< Date: Wed, 01 Apr 2009 12:31:45 GMT
< Content-Length: 218
<
* Connection #0 to host www.google.com left intact
* Closing connection #0
 [2009-04-01 13:05 UTC] ray_kimsey at ncsu dot edu
I tested on two separate servers with the same results. Both machines were are on the same network.  Thank you for your assistance.
 [2009-05-03 15:52 UTC] pajoye@php.net
Cannot reproduce, in php or in c using cURL directly. Sounds like a network issue not a php one > bogus.
 [2010-08-30 17:04 UTC] bugs dot php dot net at wandborg dot com
I can confirm this, I use http://github.com/jadb/php-
curl/blob/3d2670f42f9b2cbc3e1759e2e215cdaac5db5d79/curl.php and with 
"http://ws.spotify.com/search/1/track" it returns this:

object(Curl)#2 (26) {
  ["ch"]=>
  resource(2) of type (curl)
  ["cookie"]=>
  NULL
  ["cookieFile"]=>
  NULL
  ["cookieJar"]=>
  NULL
  ["cookies"]=>
  bool(false)
  ["encoding"]=>
  NULL
  ["encodingTypes"]=>
  array(3) {
    [0]=>
    string(8) "identity"
    [1]=>
    string(7) "deflate"
    [2]=>
    string(4) "gzip"
  }
  ["followLocation"]=>
  NULL
  ["httpHeader"]=>
  NULL
  ["httpVersion"]=>
  NULL
  ["httpVersions"]=>
  array(3) {
    [""]=>
    int(0)
    ["1.0"]=>
    int(1)
    ["1.1"]=>
    int(2)
  }
  ["info"]=>
  array(0) {
  }
  ["maxRedirects"]=>
  NULL
  ["postFields"]=>
  NULL
  ["referer"]=>
  NULL
  ["request"]=>
  NULL
  ["requestType"]=>
  string(3) "GET"
  ["requestTypes"]=>
  array(5) {
    [0]=>
    string(7) "CONNECT"
    [1]=>
    string(6) "DELETE"
    [2]=>
    string(3) "GET"
    [3]=>
    string(4) "POST"
    [4]=>
    string(3) "PUT"
  }
  ["response"]=>
  bool(false)
  ["returnHeader"]=>
  bool(true)
  ["sslVerifyHost"]=>
  NULL
  ["sslVerifyPeer"]=>
  NULL
  ["timeout"]=>
  int(60)
  ["url"]=>
  NULL
  ["userAgent"]=>
  NULL
  ["lastError"]=>
  string(15) "<url> malformed"
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC