• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Fatal error: [] operator not supported for strings

Bauer

Well-Known Member
I just started getting this fatal error in form.php - using php 7.1.3. (See attachment)

Line 4900 is...
PHP:
$group->class[] = 'fabrikGroup';
the variable $group is initialized on line 4741 as...
PHP:
$group = $groupModel->getGroupProperties($this);
which returns an object (that does not include [class]).

Initially, I assumed an easy fix for this particular "[] operator not supported for strings" error would be to just change line 4700 to...
PHP:
$group->class = array('fabrikGroup');
But I'm not sure if 'class' might sometimes already be included in the getGroupProperties - and if so would it be included as a string or an array? And might that string be a space-delimited list of class names?

In that case, replacing line 4700 with something like this should cover it all...
PHP:
if(!is_array($group->class)) {
   $group->class = (isset($group->class)) ? explode(' ',$group->class) : array();
}
$group->class[] = 'fabrikGroup';

Because of my uncertainties, I won't try to fix this at Github myself - I'm just the messenger.
But that suggested code is now working for me.
 

Attachments

  • fatalError.png
    fatalError.png
    43.3 KB · Views: 37
Last edited:
I just committed a fix.

Weird that my PHP 7.1.8 doesn't throw that.

-- hugh
It was a test user who found this just yesterday.
I was initially confused by the error too, because I know I had used that menu link in the recent past.

I just did a little research in my email notices for the nightly CRON and my site was just updated to php 7.1.9 on 2017-09-22.
Once the site goes public, I'm going to have to stop my host provider from automatically updating php because incidents like this would not be tolerated if we were 'live'.

Now the question is, where else in the Fabrik code might something like that be used? I suppose we'll soon find out.
I'm not sure I agree with throwing the fatal error but I suppose they had good reason to do so.

Anyhow, thanks for the quick response!:)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top