|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62739 getResponseCode and getResponseInfo disagree on code
Submitted: 2012-08-03 12:55 UTC Modified: 2013-10-03 01:55 UTC
From: hgs at cs dot columbia dot edu Assigned:
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.3.15 OS: Centos 5
Private report: No CVE-ID: None
 [2012-08-03 12:55 UTC] hgs at cs dot columbia dot edu
For the web site (which has one redirection), 
getResponseCode returns 302, while getResponseInfo() returns a response_code field 
of 200. In both cases, the documentation indicates that the final (last) response 
code, presumably 200, should be returned.

Test script:
$url = "";
   $r = new HttpRequest($url, HttpRequest::METH_GET);
       'redirect' => 10,
       'timeout' => 10,
       'dns_cache_timeout' => 5));
    try {
      $rc = $r->getResponseCode();
      $ri = $r->getResponseInfo();

Expected result:
$rc = 200;
$ri['response_code'] = 200


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-02 09:16 UTC]
-Status: Open +Status: Feedback -Package: HTTP related +Package: pecl_http
 [2013-10-02 09:16 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

 [2013-10-03 01:55 UTC] hgs at cs dot columbia dot edu
-Status: Feedback +Status: Closed
 [2013-10-03 01:55 UTC] hgs at cs dot columbia dot edu
The problem appears to have been fixed in pecl_http 1.7.6. (The original domain no longer exists, so this is based on another 302 domain.)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 17:01:28 2024 UTC