diff --git a/examples/openid.php b/examples/openid.php index a15189b37a..8ef34e9ee3 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -63,6 +63,16 @@ function Show_page($contents) \n"; + $contents .= "
" . htmlspecialchars($e->getMessage()) . "\n"; + $contents .= ""; + Show_page($contents); + exit; +} + + /* Need to have cookie visible from parent directory */ session_set_cookie_params(0, '/', '', false); /* Create signon session */ @@ -110,11 +120,7 @@ if (isset($_POST['identifier']) && is_string($_POST['identifier'])) { try { $o = new OpenID_RelyingParty($returnTo, $realm, $identifier); } catch (Exception $e) { - $contents = ""; - Show_page($contents); - exit; + Die_error($e); } /* Redirect to OpenID provider */ @@ -122,11 +128,7 @@ if (isset($_POST['start'])) { try { $authRequest = $o->prepare(); } catch (Exception $e) { - $contents = ""; - Show_page($contents); - exit; + Die_error($e); } $url = $authRequest->getAuthorizeURL(); @@ -143,7 +145,11 @@ if (isset($_POST['start'])) { } /* Check reply */ - $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); + try { + $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); + } catch (Exception $e) { + Die_error($e); + } $id = $message->get('openid.claimed_id');