Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcode English language messages in JComponentHelper::load() #11119

Merged
merged 1 commit into from Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 34 additions & 5 deletions libraries/cms/component/helper.php
Expand Up @@ -462,17 +462,46 @@ protected static function load($option)
}
catch (RuntimeException $e)
{
// Fatal error.
JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $e->getMessage()), JLog::WARNING, 'jerror');
/*
* Fatal error
*
* It is possible for this error to be reached before the global JLanguage instance has been loaded so we check for its presence
* before logging the error to ensure a human friendly message is always given
*/

if (JFactory::$language)
{
$msg = JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $e->getMessage());
}
else
{
$msg = sprintf('Error loading component: %1$s, %2$s', $option, $e->getMessage());
}

JLog::add($msg, JLog::WARNING, 'jerror');

return false;
}

if (empty(static::$components[$option]))
{
// Fatal error.
$error = JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND');
JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, $error), JLog::WARNING, 'jerror');
/*
* Fatal error
*
* It is possible for this error to be reached before the global JLanguage instance has been loaded so we check for its presence
* before logging the error to ensure a human friendly message is always given
*/

if (JFactory::$language)
{
$msg = JText::sprintf('JLIB_APPLICATION_ERROR_COMPONENT_NOT_LOADING', $option, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'));
}
else
{
$msg = sprintf('Error loading component: %1$s, %2$s', $option, 'Component not found.');
}

JLog::add($msg, JLog::WARNING, 'jerror');

return false;
}
Expand Down