From 47bb2b949e0d38cf9ccd5bf7b56c5c6b98638a10 Mon Sep 17 00:00:00 2001 From: Greg Rundlett Date: Thu, 12 Jul 2018 09:47:27 -0400 Subject: [PATCH] Fix false positives in checkResourceUrl() Without this proposed fix, I'm receiving false errors about the CiviCRM Resource URL not being set correctly. The stripos() function will return '0' if the needle string is the first thing found in the haystack. Thus, you must use equivalence rather than a true/false test where "position zero" evaluates to false. Tested on Civi 5.3.0 on WordPress 4.9.7 I can access http://coastaltrails.org/wp-content/plugins/civicrm/civicrm/packages/jquery/css/images/arrow.png But WITHOUT the fix, I get an error ``` The Resource URL is not set correctly. Please set the CiviCRM Resource URL. ``` I have CiviCRM Resource URL set to `[civicrm.root]/` My URL Variables are calculated as: ``` [cms.root] http://coastaltrails.org/ [civicrm.root] http://coastaltrails.org/wp-content/plugins/civicrm/civicrm/ [civicrm.files] http://coastaltrails.org/wp-content/uploads/civicrm/ These variables are computed automatically using civicrm.settings.php and its options, such as CIVICRM_TEMPLATE_COMPILEDIR. ``` --- CRM/Utils/Check/Component/Env.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index df866185edcd..a253716e42f3 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -910,7 +910,7 @@ public function checkResourceUrl() { $arrowUrl = CRM_Core_Config::singleton()->userFrameworkResourceURL . 'packages/jquery/css/images/arrow.png'; $headers = get_headers($arrowUrl); $fileExists = stripos($headers[0], "200 OK") ? 1 : 0; - if (!$fileExists) { + if ($fileExists === FALSE) { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, ts('The Resource URL is not set correctly. Please set the CiviCRM Resource URL.',