|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76684 Curl BC break with CURLOPT_URL with domain relative url
Submitted: 2018-07-30 12:14 UTC Modified: 2018-08-20 15:44 UTC
From: maggus dot staab+php at googlemail dot com Assigned: cmb (profile)
Status: Not a bug Package: cURL related
PHP Version: 7.2.8 OS:
Private report: No CVE-ID: None
 [2018-07-30 12:14 UTC] maggus dot staab+php at googlemail dot com
when using domain relative urls with curl, this worked on php5 and also on php7.0

we are in the process of testing our software with php7.2 and see that we get a error in this case "<url> malformed".

I agree using the CURLOPT_URL option without absolute urls is not ideal, but since it worked in the past I would at least not expect a BC break with this behaviour in the php7.* series

Test script:
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, '/mytest');
        $error = '';
        if (curl_errno($ch) != 0) {
            $error = curl_error($ch);



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-30 13:09 UTC]
# php -v
PHP 5.6.15 (cli) (built: Oct 29 2015 12:40:36)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
# php 76684.php
string(15) "<url> malformed"
 [2018-08-20 15:44 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2018-08-20 15:44 UTC]
I've checked the code[1], and besides a minor modification for
Windows regarding file:// URLs, the given URLs are passed
unmodified to libcurl.  Also according to the libcurl docs[2],
specifying a host is required.  If it worked for you on older
PHP versions, that's likely due to an older libcurl version.

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 23:01:24 2021 UTC