From 4a6c658f87007b96285fcc10df1866837af44a80 Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Fri, 24 Sep 2021 14:51:49 +1000 Subject: [PATCH] CIVICRM-1717 Option 1: Fix error log spam PHP message: PHP Warning: is_dir(): open_basedir restriction in effect. File ... is not within the allowed path(s) --- CRM/Admin/Page/APIExplorer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Admin/Page/APIExplorer.php b/CRM/Admin/Page/APIExplorer.php index c769535be317..31a18dce327c 100644 --- a/CRM/Admin/Page/APIExplorer.php +++ b/CRM/Admin/Page/APIExplorer.php @@ -63,7 +63,7 @@ public function run() { $paths = self::uniquePaths(); foreach ($paths as $path) { $dir = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples'; - if (is_dir($dir)) { + if (@is_dir($dir)) { foreach (scandir($dir) as $item) { if ($item && strpos($item, '.') === FALSE && array_search($item, $examples) === FALSE) { $examples[] = $item; @@ -96,7 +96,7 @@ public static function getExampleFile() { $paths = self::uniquePaths(); foreach ($paths as $path) { $dir = \CRM_Utils_File::addTrailingSlash($path) . 'api' . DIRECTORY_SEPARATOR . 'v3' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $_GET['entity']; - if (is_dir($dir)) { + if (@is_dir($dir)) { foreach (scandir($dir) as $item) { $item = str_replace('.ex.php', '', $item); if ($item && strpos($item, '.') === FALSE) {