?
avatar corejoomla
corejoomla
5 Aug 2018

Steps to reproduce the issue

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>

Expected result

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"

Actual result

Screen frozen

System information (as much as possible)

Joomla v4.0.0.alpha4
Windows, XAMPP, PHP Notice messages enabled

Additional comments

Installing only Hindi language

avatar corejoomla corejoomla - open - 5 Aug 2018
avatar joomla-cms-bot joomla-cms-bot - change - 5 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Aug 2018
avatar corejoomla corejoomla - change - 5 Aug 2018
The description was changed
avatar corejoomla corejoomla - edited - 5 Aug 2018
avatar brianteeman
brianteeman - comment - 5 Aug 2018

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

avatar mbabker
mbabker - comment - 5 Aug 2018

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);
avatar corejoomla
corejoomla - comment - 5 Aug 2018

Created PR #21413

Tested this on v4 alpha 4 and the screen is not frozen.

Additional observation: The error message is shown behind the modal backdrop and the page is redirected to the "congratulations" screen. Although it is not related to this bug.

avatar brianteeman brianteeman - change - 5 Aug 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-08-05 20:47:14
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 5 Aug 2018

Closed as we have a pr

avatar brianteeman brianteeman - close - 5 Aug 2018

Add a Comment

Login with GitHub to post a comment