Last modified: 2013-12-22 13:47:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60178, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58178 - CurlHttpRequest fails with curl < 7.16.2
CurlHttpRequest fails with curl < 7.16.2
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.22.0
All All
: Unprioritized normal (vote)
: 1.22.x release
Assigned To: Nobody - You can work on this!
: code-update-regression
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-08 10:27 UTC by sen
Modified: 2013-12-22 13:47 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description sen 2013-12-08 10:27:42 UTC
i found this,is maybe a bug?

PHP Notice:  Use of undefined constant CURLOPT_CONNECTTIMEOUT_MS - assumed 'CURLOPT_CONNECTTIMEOUT_MS' in w/includes/HttpFunctions.php on line 733
Comment 1 sen 2013-12-08 10:29:34 UTC
and i always got this,i dont know it's my code problem or the mw,it's been work good before V1.22




 PHP Warning:  curl_setopt_array() [<a href='function.curl-setopt-array'>function.curl-setopt-array</a>]: Array keys must be CURLOPT constants or equivalent integer values in /w/includes/HttpFunctions.php on line 771

here is my code:

        $authUrl = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13/"; //验证地址
        
        $options = array(); //看起来定义它是必要的
        $options['method']   = 'POST';
        $options['timeout']  = $this->config['timeout']; //有趣的是,在class里看起来是共享的
        $options['postData'] = array(
            'grant_type' => "client_credentials", //验证地址
            'scope' => "http://api.microsofttranslator.com", //使用范围,因为这套api看起来是很全面的玩意
            'client_id' => $clientID,
            'client_secret' => $clientSecret
        );

        wfErrorLog('工厂构造'.serialize($options), '/tmp/wm.log' ); //调试信息

        $req = MWHttpRequest::factory($authUrl, $options);
Comment 2 sen 2013-12-08 10:30:17 UTC
(In reply to comment #1)
> and i always got this,i dont know it's my code problem or the mw,it's been
> work
> good before V1.22
> 
> 
> 
> 
>  PHP Warning:  curl_setopt_array() [<a
> href='function.curl-setopt-array'>function.curl-setopt-array</a>]: Array keys
> must be CURLOPT constants or equivalent integer values in
> /w/includes/HttpFunctions.php on line 771
> 
> here is my code:
> 
>         $authUrl =
> "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13/"; //验证地址
> 
>         $options = array(); //看起来定义它是必要的
>         $options['method']   = 'POST';
>         $options['timeout']  = $this->config['timeout'];
> //有趣的是,在class里看起来是共享的
>         $options['postData'] = array(
>             'grant_type' => "client_credentials", //验证地址
>             'scope' => "http://api.microsofttranslator.com",
> //使用范围,因为这套api看起来是很全面的玩意
>             'client_id' => $clientID,
>             'client_secret' => $clientSecret
>         );
> 
>         wfErrorLog('工厂构造'.serialize($options), '/tmp/wm.log' ); //调试信息
> 
>         $req = MWHttpRequest::factory($authUrl, $options);

        wfErrorLog('开始请求\n', '/tmp/wm.log' ); //调试信息        

        $status = $req->execute(); //看起来死在这里,问题是选项啥的
Comment 3 Brad Jorsch 2013-12-08 16:30:03 UTC
It sounds like you need to update either your version of PHP or your php-curl module. According http://www.php.net/curl_setopt the CURLOPT_CONNECTTIMEOUT_MS constant was added in cURL 7.16.2 and has been available in PHP since 5.2.3. Since MediaWiki requires PHP 5.3.2, there's no reason you shouldn't have that constant available.
Comment 4 sen 2013-12-08 17:06:00 UTC
hmm,i will have a try,thx!

maybe mw can make a error log:"you curl version is too low,plz upgrade"?
Comment 5 Kevin Israel (PleaseStand) 2013-12-08 17:12:06 UTC
(In reply to comment #3)
> It sounds like you need to update either your version of PHP or your php-curl
> module. According http://www.php.net/curl_setopt the
> CURLOPT_CONNECTTIMEOUT_MS
> constant was added in cURL 7.16.2 and has been available in PHP since 5.2.3.
> Since MediaWiki requires PHP 5.3.2, there's no reason you shouldn't have that
> constant available.

Not the PHP extension, but rather libcurl itself -- the PHP extension may have been compiled against an old version of the library. In that case, the constant could be missing. From ext/curl/interface.c in PHP 5.3 (similar code exists even in newer PHP versions):

#if LIBCURL_VERSION_NUM > 0x071002
        REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT_MS);
#endif
Comment 6 sen 2013-12-09 06:49:25 UTC
thx!it had be fix,after recompile the php-curl,and update the curl 7.33.0
Comment 7 Andre Klapper 2013-12-09 11:58:19 UTC
[No codefix in MediaWiki code, hence changing resolution to WORKSFORME]
Comment 8 Kevin Israel (PleaseStand) 2013-12-09 16:26:33 UTC
Reopening. This was needless breakage caused by Gerrit change #58247,
which added a feature chiefly for Wikimedia's use. Fortunately, the
patch is very, very simple.
Comment 9 Gerrit Notification Bot 2013-12-09 16:33:57 UTC
Change 100390 had a related patch set uploaded by PleaseStand:
Restore compatibility with curl < 7.16.2

https://gerrit.wikimedia.org/r/100390
Comment 10 Brad Jorsch 2013-12-09 16:46:33 UTC
I'm inclined to reclose this.

We require PHP 5.3.2, which was released 4 March 2010. Curl 7.16.2 was released 11 April *2007*, almost three years earlier. Do we really need to maintain compatibility with a version of a library that's almost 7 years old and is 3 years older than other software we require?
Comment 11 Max Semenik 2013-12-09 17:09:36 UTC
Do we have evidence that any supported version of any popular distro is affected? If so, we should take some care to maintain compatibility. Otherwise, we can't maintain compatibility with infinite number of DIY distros/PHP builds.
Comment 12 Kevin Israel (PleaseStand) 2013-12-09 17:19:09 UTC
(In reply to comment #11)
> Do we have evidence that any supported version of any popular distro is
> affected? If so, we should take some care to maintain compatibility.
> Otherwise,
> we can't maintain compatibility with infinite number of DIY distros/PHP
> builds.

RHEL/CentOS 5, though MW 1.22 is also incompatible with that distribution's php53 package in a different way (bug 58213).

If we do wish to drop support for old versions of curl, we should add:

* a version check in MWHttpRequest::factory(); and
* an entry in the RELEASE-NOTES file.
Comment 13 Gerrit Notification Bot 2013-12-09 17:49:26 UTC
Change 100390 merged by jenkins-bot:
Restore compatibility with curl < 7.16.2

https://gerrit.wikimedia.org/r/100390
Comment 14 Gerrit Notification Bot 2013-12-10 12:33:19 UTC
Change 100556 had a related patch set uploaded by MarkAHershberger:
Restore compatibility with curl < 7.16.2

https://gerrit.wikimedia.org/r/100556
Comment 15 Gerrit Notification Bot 2013-12-10 12:38:21 UTC
Change 100556 merged by jenkins-bot:
Restore compatibility with curl < 7.16.2

https://gerrit.wikimedia.org/r/100556
Comment 16 Andre Klapper 2013-12-17 09:34:48 UTC
All patches merged. Assuming this is RESOLVED FIXED.
Comment 17 sen 2013-12-22 13:47:27 UTC
i so happy it be fixed!yep,i use centos 5,if update the curl which a lot probelm,the php53 cant install anymore,it need [yum install curl]for it!
so this is just very great for the people like me.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links