From a7318bf8468af0954bdda068ee63bd2ce442ea49 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 8 Feb 2010 20:10:07 +0000 Subject: [PATCH] BUGFIX: Fixed infinite loop in FILE_TO_URL_MAPPING lookup when calling arbitrary scripts via CLI git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98434 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/Core.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/Core.php b/core/Core.php index 313e196c2..39d8632e9 100755 --- a/core/Core.php +++ b/core/Core.php @@ -23,7 +23,6 @@ if(defined('E_DEPRECATED')) error_reporting(E_ALL ^ E_DEPRECATED); else error_reporting(E_ALL); - /* * This is for versions of PHP prior to version 5.2 * Creating this here will allow both web requests and cron jobs to inherit it. @@ -60,7 +59,7 @@ foreach($envFiles as $envFile) { if(!isset($_SERVER['HTTP_HOST'])) { // HTTP_HOST, REQUEST_PORT, SCRIPT_NAME, and PHP_SELF if(isset($_FILE_TO_URL_MAPPING)) { - $fullPath = $testPath = $_SERVER['SCRIPT_FILENAME']; + $fullPath = $testPath = realpath($_SERVER['SCRIPT_FILENAME']); while($testPath && $testPath != "/" && !preg_match('/^[A-Z]:\\\\$/', $testPath)) { if(isset($_FILE_TO_URL_MAPPING[$testPath])) { $url = $_FILE_TO_URL_MAPPING[$testPath]