- Affected version
- 2.2.5
Related to; https://xenforo.com/community/threads/redundant-io-check-on-loading-phrase-group.195751/
In
Rough prototyped replacement;
In
XF\Template\Templater::getTemplateDataFromSource
, there is a file_exists
check before an include
call, which is redundant;
PHP:
protected function getTemplateDataFromSource($type, $name)
{
$file = $this->getTemplateFilePath($type, $name);
if (!file_exists($file))
{
return false;
}
return include($file);
}
include
returns false on if the file can't be accessed or readable (the warning is converted into an exception by XF), as such the file_exists
check is redundant.Rough prototyped replacement;
PHP:
protected function getTemplateDataFromSource($type, $name)
{
$file = $this->getTemplateFilePath($type, $name);
try
{
return include($file);
}
catch (\Throwable $e)
{
return false;
}
}