BUGFIX Check for existence of REQUEST_URI IN Director::forceSSL() and Director::absoluteURL() (forceSSL() is typically called in _config.php, which fails when executed through cli-script.php)

This commit is contained in:
Ingo Schommer 2010-12-06 12:34:19 +13:00
parent a7e9be3bc4
commit 04c8124f39

View File

@ -337,6 +337,8 @@ class Director {
* @todo Document how relativeToSiteBase works * @todo Document how relativeToSiteBase works
*/ */
static function absoluteURL($url, $relativeToSiteBase = false) { static function absoluteURL($url, $relativeToSiteBase = false) {
if(!isset($_SERVER['REQUEST_URI'])) return false;
if(strpos($url,'/') === false && !$relativeToSiteBase) $url = dirname($_SERVER['REQUEST_URI'] . 'x') . '/' . $url; if(strpos($url,'/') === false && !$relativeToSiteBase) $url = dirname($_SERVER['REQUEST_URI'] . 'x') . '/' . $url;
if(substr($url,0,4) != "http") { if(substr($url,0,4) != "http") {
@ -615,6 +617,8 @@ class Director {
* @return boolean|string String of URL when unit tests running, boolean FALSE if patterns don't match request URI * @return boolean|string String of URL when unit tests running, boolean FALSE if patterns don't match request URI
*/ */
static function forceSSL($patterns = null) { static function forceSSL($patterns = null) {
if(!isset($_SERVER['REQUEST_URI'])) return false;
$matched = false; $matched = false;
if($patterns) { if($patterns) {