From bbfb4d78d2c148304b64d7f769a0565d47f3ac52 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 14 Mar 2018 10:37:24 -0400 Subject: [PATCH] Update for additional suggestions in processwire/processwire-issues#518 --- wire/core/ProcessWire.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wire/core/ProcessWire.php b/wire/core/ProcessWire.php index 51b1a78b..8467567b 100644 --- a/wire/core/ProcessWire.php +++ b/wire/core/ProcessWire.php @@ -743,15 +743,19 @@ class ProcessWire extends Wire { * @param array $options Options to modify default behaviors (experimental): * - `siteDir` (string): Name of "site" directory in $rootPath that contains site's config.php, no slashes (default="site"). * @return Config + * @throws WireException * */ public static function buildConfig($rootPath, $rootURL = null, array $options = array()) { + if(strpos($rootPath, '..') !== false) { + $rootPath = realpath($rootPath); + if($rootPath === false) throw new WireException("Path not found"); + } + if(DIRECTORY_SEPARATOR != '/') { $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath); } - - if(strpos($rootPath, '..') !== false) $rootPath = realpath($rootPath); $httpHost = ''; $scheme = '';