Creating default object from empty value using php 7.4.22

When using Studio and click on fields, it returns this error:
Creating default object from empty value in /var/www/suitecrm/modules/ModuleBuilder/views/view.modulefields.php on line 109
This happens with php 7.4.22 and SuiteCRM 7.11.20
Not happens with 7.3
Can you help us ? I would like to use 7.4 and no more 7.3
Thanks

did you got any solution for this error?
I have same error after transfer SuiteCRM from local machine to server.

Hey folk, are you able to provide any php error logs to narrow this down? It would be much appreciated.

This is my log error.
[Fri Oct 08 14:26:58.954210 2021] [php7:warn] [pid 24142] [client 10.0.3.2:32972] PHP Warning: Creating default object from empty value in /var/www/suitecrm/modules/ModuleBuilder/views/view.modulefields.php on line 109, referer: https://crmtest.pqe.eu/index.php?module=ModuleBuilder&action=index&type=studio

Super thanks.

Ok, we do have a step forward to a degree. These are warnings, if you so incline you can set your PHP to ignore them. I think in PHP 7.4 the default is to show all errors including warnings.
That would be the quick win.

However, the route of the issue looks like there is an object that isnā€™t being declared prior to line 109. Now Iā€™m not sure yet which part that would be yet, but it could be either

$studioClass

or

$studioClass->mbvardefs

So there still will need to be a wee investigation on what it is, PR created and tested BUT as I said you can jump over this y setting your php.ini to ignore all Warnings.

Hi,
I cannot ignore removing warnings because I canā€™t work with fields. This attached is how it is when Iā€™m clicking on Fields .

Hi @alessandro

When I mean removing the warnings I am referring to updating your php.ini on the server that your SuiteCRM instance sits on. Have a quick read on how to do this if you were on a linux server.

Now, if possible, you could help me out with testing some code to actually resolve this issue rather than switching off your warnings via PHP.

If you are able to edit the file modules/ModuleBuilder/views/view.modulefields.php with adding in the following code that would be super. Obviously, try this on a local or test instance, not production!

Hi,
now it works adding class creation if not exists as in line 158.
Thanks.

Thanks @alessandro

You had confused me there. Are you confirming that adding the following code to LINE 89 in modules/ModuleBuilder/views/view.modulefields.php has resolved your issue?

            global $dictionary;
        if (!isset($studioClass->mbvardefs) || is_null($studioClass->mbvardefs)) {
            $studioClass->mbvardefs = new stdClass();
        }

If it has then super. Can you also comment on the GitHub PR so that it helps the devs to merge it in :slight_smile: Awesome work. Thanks for your participation.

1 Like

@samus-aran after adding your code on line 89 in modules/ModuleBuilder/views/view.modulefields.php.
warning has been removed but now I am getting this new database failure error.

Ok. So what does the database error say?

ā€œPlease refer to suitecrm.log for detailsā€

Hey Guys, not sure if itā€™s relevant here, but I had a similar kind of error in Studio when trying to add a relationship. I fixed it by re-building the JS files in Repair. It then allowed me to proceed with adding a relationship.

https://community.suitecrm.com/t/relationship-popup-not-working-in-studio-7-10-25/78900/3

I can confirm, that the change in view.modulefields.php is working

System:
suiteCRM 7.11.22
PHP 7.4.25
MySQL 5.7

when will we see this in the main branch?