From ecc73e0cfc78bf6a4a76b9433cc4d1cdc039dd13 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 13 Apr 2010 03:24:48 +0000 Subject: [PATCH] BUGFIX: Fixed infinite loop in FILE_TO_URL_MAPPING lookup when calling arbitrary scripts via CLI (from r98434) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102658 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 f73a20d80..43f8483b3 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]