php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58640 Add support for 201 HTTP code
Submitted: 2009-04-21 20:27 UTC Modified: 2009-04-22 02:08 UTC
From: challgren at hallgrennetwork dot com Assigned:
Status: Closed Package: oauth (PECL)
PHP Version: 5.2.9 OS: CentOS 5
Private report: No CVE-ID: None
 [2009-04-21 20:27 UTC] challgren at hallgrennetwork dot com
Description:
------------
Some OAuth providers don't just use 200 to report a successful response. For example www.brightkite.com will return a 201 response if a post was "Created"

Reproduce code:
---------------
Do a OAauth POST to http://brightkite.com/places/4c5ac7907dcc11ddae3d0030487eb504/notes.json

Expected result:
----------------
OAuth not to throw an exception because a 201 was passed back

Actual result:
--------------
OAuthException Object
(
    [message:protected] => Invalid auth/bad request (got a 201, expected 200 or a redirect)
    [string:private] => 
    [code:protected] => 201
    [file:protected] => /home/chrish/public_html/brightkite/updateStatus.php
    [line:protected] => 23
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => /home/chrish/public_html/brightkite/updateStatus.php
                    [line] => 23
                    [function] => fetch
                    [class] => OAuth
                    [type] => ->
                    [args] => Array
                        (
                            [0] => http://brightkite.com/places/4c5ac7907dcc11ddae3d0030487eb504/notes.json
                            [1] => Array
                                (
                                    [note[body]] => 'hi' from pecl/oauth
                                )

                            [2] => POST
                        )

                )

        )

    [lastResponse] => {"body": "'hi' from pecl/oauth", "created_at_as_words": "less than a minute", "created_at": "2009/04/22 00:13:13 +0000", "via": "web", "public": false, "place": {"scope": "address", "longitude": -104.982366, "name": "Brightkite", "latitude": 39.762352, "id": "4c5ac7907dcc11ddae3d0030487eb504", "display_location": "2911 Walnut St, Denver, CO 80205, USA"}, "about": true, "object_type": "note", "comments_count": 0, "creator": {"small_avatar_url": "http://s3.amazonaws.com/bk_store/images/user/avatar/aa56d9689a5211dd9951003048c10834/avatar-small.png?1238885267", "login": "challgren", "smaller_avatar_url": "http://s3.amazonaws.com/bk_store/images/user/avatar/aa56d9689a5211dd9951003048c10834/avatar-smaller.png?1238885267", "fullname": "Chris Hallgren", "tiny_avatar_url": "http://s3.amazonaws.com/bk_store/images/user/avatar/aa56d9689a5211dd9951003048c10834/avatar-tiny.png?1238885267"}, "id": "5e74d4902ed211dea60f003048c0801e", "created_at_ts": "1240359193.041662"}
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-21 20:31 UTC] jawed@php.net
I think we should just support all 20X status codes, I'll commit a fix for this tonight and roll it out in the next version 0.99.6 (tomorrow) which also supports win32 builds.
 [2009-04-22 02:08 UTC] jawed@php.net
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/oauth


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC