Upgrade to 7.14.2 and PHP 8.1 (or 8.0) causes Project subpanels to disappear

Just upgraded to 7.14.2 and as a consequence switched to PHP 8.1. Everything seemed to go fine but my subpanels are missing in the Projects Module. When I switch back to PHP 7.4, my subpanels come back no problem.

I’m stumped, there are no errors in the log and no errors in console. I’ve done R&R, reset my permissions, rebuild all the JS stuff and still, no subpanels. It only happens with 8.0 and 8.1. With 7.4 it works fine.

Anyone else? Just me? I tried the online demo and it seems to work properly.

OK if anyone else has this problem, after hours of troubleshooting and doing a complete fresh install that seemed to work fine, I concluded it had to be in my user cache. So went to my profile and “Reset User Preferences” and now subpanels appear in projects.

1 Like

Ok This one isn’t exactly solved yet. I’ve narrowed it down to the “Resources” tab. In PHP 8.1 get a continuous loading. As soon as I open the tab and refresh, no subpanels work anymore and everything is blank. If I revert back to 7.4, close the resources tab, and then back to 8.1 all is good, until I open the Resources tab. So at least I have a trail to follow…

There is nothing I can see relevant in console or the error log.

Is it just me or anyone else?

The issue you’re seeing usually happens when the functionality that is part of retrieving/displaying that subpanel’s records has a fatal failure. Have you checked your apache log? It’s most likely an issue with a deprecated function or standard that changed between PHP 7 and 8. The apache log should tell you the file path where the fatal error occurred.

1 Like

Nice! I always forget to check the Apache logs, I usually find what I need in console or the sugarcrm log.

Here’s what I found, I think this is it,

[28-Feb-2024 16:57:04 UTC] PHP Fatal error:  Declaration of SugarWidgetSubPanelTopSelectUsersButton::display(&$widget_data) must be compatible with SugarWidgetSubPanelTopSelectButton::display($widget_data, $additionalFormFields = null, $nonbutton = false) in /home/xxxxxxxxxxxxxxxxxx/custom/include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectUsersButton.php on line 56

That looks like it, it’s an error that can crop up sometimes when upgrading to PHP 8. If a function in a child class is missing arguments that the parent has, PHP 8 throws a fatal error. Previously, PHP 7 would throw a warning, which is why you would see the subpanel work in that version.
If you update the custom SugarWidgetSubPanelTopSelectUsersButton class’s display function to include the ($widget_data, $additionalFormFields = null, $nonbutton = false) arguments then it should start working as expected.

1 Like

Ok I fixed it… there are two files that need to be fixed:
\custom\include\generic\SugarWidgets\SugarWidgetSubPanelTopSelectUsersButton.php

and

\custom\include\generic\SugarWidgets\SugarWidgetSubPanelTopSelectContactsButton.php

I had to change the display function in a couple of places. But my real question is, where does this file come from? I looked on Github to see if I had the most recent version, and it doesn’t exist in the repository? It’s nothing I created. I wonder if its a hold over from an old version?

I’m wondering if I just disable, the /custom/ files? Thinking out loud, going to try that.

Ok, fixing the two files worked. But just deleting them, also works!

\custom\include\generic\SugarWidgets\SugarWidgetSubPanelTopSelectUsersButton.php

and

\custom\include\generic\SugarWidgets\SugarWidgetSubPanelTopSelectContactsButton.php