Apply part of joomla/joomla-platform#1769