Merge pull request #9642 from samoser/patch-1

PATCH: Prevents calling strpos with empty needle
This commit is contained in:
Robbie Averill 2020-08-18 10:29:38 -07:00 committed by GitHub
commit 9567a9e768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2614,8 +2614,10 @@ class i18n extends SS_Object implements TemplateGlobalProvider, Flushable {
$themesBase = Director::baseFolder() . '/themes';
if(is_dir($themesBase)) {
foreach(scandir($themesBase) as $theme) {
$themename = (string)Config::inst()->get('SSViewer', 'theme');
if(
strpos($theme, (string)Config::inst()->get('SSViewer', 'theme')) === 0
!empty($themename)
&& strpos($theme, $themename) === 0
&& file_exists("{$themesBase}/{$theme}/lang/")
) {
$filename = $adapter->getFilenameForLocale($locale);