Prerequisites: PHP notice messages are enabled
After installing Joomla, go to customization and select language say Hindi for installation. If the language cannot be installed, the server will not return any value, and the value is null. But the below code is accessing its properties without checking the data is null or not.
\installation\src\Model\LanguagesModel.php
return trim($update->get('downloadurl', false)->_data);
This resulted in a notice message causing json response invalid.
Notice: Trying to get property of non-object in D:\xampp\htdocs\joomla\installation\src\Model\LanguagesModel.php on line <i>253</i>
The installer shows message that it cannot install selected language.
"Joomla was unable to install Hindi language. You will be able to install it later using the Joomla Administrator"
Screen frozen
Joomla v4.0.0.alpha4
Windows, XAMPP, PHP Notice messages enabled
Installing only Hindi language
Labels |
Added:
?
|
It is a real bug.
return trim($update->get('downloadurl', false)->_data);
The update object being returned here is a subclass of the deprecated Joomla\CMS\Object\CMSObject
. Calling its get()
method will try to return the value of the property name you give in the first argument, and if not set will return whatever you give as the second argument. So in this case, when the "downloadurl" property isn't set, a boolean false is being returned. You can't access properties of an object on a boolean value.
So, it needs to be something like this:
$downloadUrl = $update->get('downloadurl', false);
if ($downloadUrl === false) {
return '';
}
return trim($downloadUrl->_data);
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-08-05 20:47:14 |
Closed_By | ⇒ | brianteeman |
Closed as we have a pr
At this moment in time I understand this to be expected behaviour as only 3 languages are setup for testing with joomla 4
However I am not 100% certain so leaving this open for someone else to confirm that this is expected or not