Backport #3182

https://github.com/joomla/joomla-cms/pull/3182