php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62144 OAuth::fetch returns FALSE for empty response body
Submitted: 2012-05-24 19:16 UTC Modified: 2012-05-26 14:55 UTC
From: andrew at pimlott dot net Assigned: jawed (profile)
Status: Closed Package: oauth (PECL)
PHP Version: 5.3.13 OS: Debian Linux
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: andrew at pimlott dot net
New email:
PHP Version: OS:

 

 [2012-05-24 19:16 UTC] andrew at pimlott dot net
Description:
------------
OAuth::fetch returns FALSE if the response is empty (Content-Length 0).  As far 
as I can tell, there is no reason that should be considered a failure.  A simple 
test you can use on any HTTPS URL with an empty response:

I'm guessing this happens because soo->lastresponse.c remains NULL until some 
content has been appended.

Test script:
---------------
$oauth = new OAuth('foo', 'bar');
if ($oauth->fetch('https://example.com/empty') === FALSE) {
  echo("false\n");
}


Expected result:
----------------
No output.

Actual result:
--------------
Prints "false".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-24 19:19 UTC] andrew at pimlott dot net
-Summary: OAuth::fetch returns FALSE for empty response +Summary: OAuth::fetch returns FALSE for empty response body
 [2012-05-24 19:19 UTC] andrew at pimlott dot net
To clarify, I mean that it returns FALSE if the response body is empty.  The HTTP 
response is otherwise well-formed.
 [2012-05-24 20:56 UTC] jawed@php.net
I think it's fine to return TRUE if the HTTP response code was 200 instead of 
FALSE. If the HTTP response code was not a 200 we would still return FALSE.
 [2012-05-24 20:56 UTC] jawed@php.net
Err, if the code was in 20X not 200.
 [2012-05-24 21:07 UTC] jawed@php.net
Automatic comment from SVN on behalf of jawed
Revision: http://svn.php.net/viewvc/?view=revision&revision=325799
Log: Bug 62144
 [2012-05-24 21:08 UTC] jawed@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: jawed
 [2012-05-24 21:08 UTC] jawed@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-05-26 14:55 UTC] andrew at pimlott dot net
Awesome, thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC