Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-06-17 15:26:05 +0300
committerMichal Čihař <michal@cihar.com>2016-06-17 15:26:59 +0300
commit27664605b945b13e1d2b71adea822ace2099cc96 (patch)
tree4312942c12beae4866899a92a09a329fbf441291 /examples
parent00b9be9c4afa98d1a37f2b74c75f8c67ccf251d4 (diff)
Improve error handling in OpenID example
- properly check parameter types - catch all exceptions (eg. network error) Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/openid.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/openid.php b/examples/openid.php
index da4a13fb53..ab7707f538 100644
--- a/examples/openid.php
+++ b/examples/openid.php
@@ -98,9 +98,9 @@ OpenID: <input type="text" name="identifier" /><br />
}
/* Grab identifier */
-if (isset($_POST['identifier'])) {
+if (isset($_POST['identifier']) && is_string($_POST['identifier'])) {
$identifier = $_POST['identifier'];
-} else if (isset($_SESSION['identifier'])) {
+} else if (isset($_SESSION['identifier']) && is_string($_SESSION['identifier'])) {
$identifier = $_SESSION['identifier'];
} else {
$identifier = null;
@@ -109,7 +109,7 @@ if (isset($_POST['identifier'])) {
/* Create OpenID object */
try {
$o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
-} catch (OpenID_Exception $e) {
+} catch (Exception $e) {
$contents = "<div class='relyingparty_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
$contents .= "</div class='relyingparty_results'>";