avoid notices on undefined array elements

This commit is contained in:
Evan Prodromou 2009-02-20 16:44:56 -05:00
parent 76d506cf16
commit 5c59c0d90c

View File

@ -27,12 +27,13 @@ $action = null;
function getPath($req) function getPath($req)
{ {
if (common_config('site', 'fancy')) { if ((common_config('site', 'fancy') || !array_key_exists('PATH_INFO', $_SERVER))
&& array_key_exists('p', $req)) {
return $req['p']; return $req['p'];
} else if ($_SERVER['PATH_INFO']) { } else if (array_key_exists('PATH_INFO', $_SERVER)) {
return $_SERVER['PATH_INFO']; return $_SERVER['PATH_INFO'];
} else { } else {
return $req['p']; return null;
} }
} }