diff options
author | Kevin Turner <kevin@janrain.com> | 2008-06-04 22:28:32 +0000 |
---|---|---|
committer | Kevin Turner <kevin@janrain.com> | 2008-06-04 22:28:32 +0000 |
commit | fe580046be183271d74a2286b5f67a9507944600 (patch) | |
tree | 812a5de485b82d3b4cf23a4fb4d7a0338901dd74 /Auth | |
parent | ac100f4cc2355639d2535ceaac4d83fe64e70d18 (diff) | |
download | php-openid-fe580046be183271d74a2286b5f67a9507944600.zip php-openid-fe580046be183271d74a2286b5f67a9507944600.tar.gz php-openid-fe580046be183271d74a2286b5f67a9507944600.tar.bz2 |
[project @ Auth_OpenID_Decoder::decode: make sure Auth_OpenID_ServerError has an Auth_OpenID_Message after encountering invalid OpenID namespace]
Diffstat (limited to 'Auth')
-rw-r--r-- | Auth/OpenID/Server.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Auth/OpenID/Server.php b/Auth/OpenID/Server.php index 1c87758..7c56805 100644 --- a/Auth/OpenID/Server.php +++ b/Auth/OpenID/Server.php @@ -1522,6 +1522,23 @@ class Auth_OpenID_Decoder { $message = Auth_OpenID_Message::fromPostArgs($query); + if ($message === null) { + /* + * It's useful to have a Message attached to a + * ProtocolError, so we override the bad ns value to build + * a Message out of it. Kinda kludgy, since it's made of + * lies, but the parts that aren't lies are more useful + * than a 'None'. + */ + $old_ns = $query['openid.ns']; + + $query['openid.ns'] = Auth_OpenID_OPENID2_NS; + $message = Auth_OpenID_Message::fromPostArgs($query); + return new Auth_OpenID_ServerError( + $message, + sprintf("Invalid OpenID namespace URI: %s", $old_ns)); + } + $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode'); if (!$mode) { return new Auth_OpenID_ServerError($message, |