summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@cprogrammer.org>2007-11-13 00:25:38 +0000
committertailor <cygnus@cprogrammer.org>2007-11-13 00:25:38 +0000
commite979de3435ac4bafca4ad0d9ce90723bdb9b23f9 (patch)
treed2e3e2798d19dd5c6caa4948d645b32466a0818f
parent949c04cc83a6cc94182e99265fe18e7da2845531 (diff)
downloadphp-openid-e979de3435ac4bafca4ad0d9ce90723bdb9b23f9.zip
php-openid-e979de3435ac4bafca4ad0d9ce90723bdb9b23f9.tar.gz
php-openid-e979de3435ac4bafca4ad0d9ce90723bdb9b23f9.tar.bz2
[project @ Make Auth_Yadis_identifierScheme handle an empty string]
-rw-r--r--Auth/Yadis/XRI.php3
-rw-r--r--Tests/Auth/Yadis/XRI.php3
2 files changed, 5 insertions, 1 deletions
diff --git a/Auth/Yadis/XRI.php b/Auth/Yadis/XRI.php
index d9d0726..da9ece3 100644
--- a/Auth/Yadis/XRI.php
+++ b/Auth/Yadis/XRI.php
@@ -43,7 +43,8 @@ function Auth_Yadis_getXrefRE()
function Auth_Yadis_identifierScheme($identifier)
{
if (Auth_Yadis_startswith($identifier, 'xri://') ||
- (in_array($identifier[0], Auth_Yadis_getXRIAuthorities()))) {
+ ($identifier &&
+ in_array($identifier[0], Auth_Yadis_getXRIAuthorities()))) {
return "XRI";
} else {
return "URI";
diff --git a/Tests/Auth/Yadis/XRI.php b/Tests/Auth/Yadis/XRI.php
index 8d5aa0d..ce2ecfa 100644
--- a/Tests/Auth/Yadis/XRI.php
+++ b/Tests/Auth/Yadis/XRI.php
@@ -21,6 +21,9 @@ class Tests_Auth_Yadis_XriDiscoveryTestCase extends PHPUnit_TestCase {
Auth_Yadis_identifierScheme('=john.smith'), 'XRI');
$this->assertEquals(
+ Auth_Yadis_identifierScheme(''), 'URI');
+
+ $this->assertEquals(
Auth_Yadis_identifierScheme('@smiths/john'), 'XRI');
$this->assertEquals(