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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 17 = ?
Subscribe to this entry?

 
 [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: Wed Dec 11 03:01:28 2024 UTC