Fix resource path check when ResourceBasePath is an empty string
authorTim Starling <tstarling@wikimedia.org>
Mon, 22 Feb 2016 03:51:19 +0000 (14:51 +1100)
committerTim Starling <tstarling@wikimedia.org>
Mon, 22 Feb 2016 22:19:26 +0000 (09:19 +1100)
commita2530a9fb83a20f5520ba726873e2260a3b4fd26
treefa0fd057f98f907544826304c0712fd899e0912b
parenta85d1b9d0cd7f02111d3a647d5b91e3b1f334563
Fix resource path check when ResourceBasePath is an empty string

If you have MediaWiki installed in the root of the domain, then
$wgScriptPath and $wgResourceBasePath is an empty string. In HHVM and
PHP, passing an empty string as the second parameter of strpos() causes
a warning and returns false, which will cause the condition to fail, as
if the path were not within the base path.

So, normalize such paths. Using substr() instead of strpos() for a
"starts with" check would have worked except that RelPath also fails
when given an empty string.

Bug: T127652
Change-Id: If7e94ae638d6834f7cc0f31f67a5fe6a2f74771c
includes/OutputPage.php