Fix false positives in checkResourceUrl()
authorGreg Rundlett <greg@eQuality-Tech.com>
Thu, 12 Jul 2018 13:47:27 +0000 (09:47 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 16 Jul 2018 16:28:32 +0000 (12:28 -0400)
commit47bb2b949e0d38cf9ccd5bf7b56c5c6b98638a10
tree2615efb3997861924bc9fb3b25f0a332372d0d4d
parenta1c9dcb964db0ead86b65a1f3015c261d5b79695
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