Steps to reproduce the issue
Install a language pack (German, French or Persian are available through Install Languages)
Then go to Extensions : Manage and uninstall the pack
Actual result
Pack is correctly uninstalled.
Notices in php logs
[17-Jul-2018 07:27:54 Europe/Berlin] PHP Notice: Undefined variable: element in /Applications/MAMP/htdocs/installmulti/joomla40/libraries/src/Installer/Adapter/LanguageAdapter.php on line 122
[17-Jul-2018 07:27:54 Europe/Berlin] PHP Notice: Undefined variable: element in /Applications/MAMP/htdocs/installmulti/joomla40/libraries/src/Installer/Adapter/LanguageAdapter.php on line 122
[17-Jul-2018 07:27:54 Europe/Berlin] PHP Notice: Undefined variable: error in /Applications/MAMP/htdocs/installmulti/joomla40/libraries/src/Installer/Adapter/PackageAdapter.php on line 445
PR #21199