View the status page with Ubercart 8x installed shows the following error at the top of the status page:

Warning: Invalid argument supplied for foreach() in Drupal\system\Element\StatusReportPage::preRenderGeneralInfo()

It's related, to a missing description key in uc_store_requirements.

Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

3CWebDev created an issue. See original summary.

3CWebDev’s picture

3CWebDev’s picture

Status: Active » Needs review
3CWebDev’s picture

TR’s picture

Status: Needs review » Needs work

I don't understand this. 'description' is not required - indeed, some core modules don't use it (see for example the search module and the system module). Also, the API documentation in core/lib/Drupal/Core/Extension/module.api.php shows an example which does not use 'description'. I think this is a core bug with StatusReportPage.php - it should be checking to see if a description element is provided before using it ...

This seems to be an unintentional side-effect from the core change in #665790: Redesign the status report page, There is no mention in that issue of changing what is stored in the 'value' and 'description' keys, and no mention about changing them from optional to required. But it seems that they did change. I consider that a regression since it operates differently than before the change and since it is not a documented intentional change.

As far as a fix, I would like to see this pursued in the core issue queue first, and if it is indeed declared to be intentional (despite all evidence) then I think uc_store_requirements() should be fixed to put the 'desc' data into the 'description' element, not into the 'value' element like it currently does, and 'value' should be assigned a suitable non-empty value. I don't think setting 'description' to [] is the appropriate fix. First because it should not be an array, but second because it should contain a meaningful value if we are going to use it.

BTW, Drupal core testing changed last week, which caused the tests to start running with a PHP 5.5/D8.8 combination, which is why they failed (D8.8 no longer supports PHP 5). I fixed the configuration so the testbot won't try that again.

3CWebDev’s picture

The original thread which led me to finding out that the trouble module as uc_store is here:

https://www.drupal.org/project/drupal/issues/2876308

It's in the Drupal core issue queue but the fix was for uc_store.

I'm not suggesting anything here other than providing more information.

TR’s picture

Can you try the fix from #2876308-16: Warning: Invalid argument supplied for foreach() in Drupal\system\Element\StatusReportPage::preRenderGeneralInfo() on status page?
The fix in #2876308-17: Warning: Invalid argument supplied for foreach() in Drupal\system\Element\StatusReportPage::preRenderGeneralInfo() on status page, which is the same as your patch, is wrong for the above reasons. The fix in #16 is also wrong (using $requirements[] to automatically assign the key should always work, there should be no need to explicitly write the module name as the key), but if that works for you that is a more understandable problem even though it also points to a bug in the core implementation.

I sure would have been nice if someone would have mentioned this in the Ubercart issue queue before now ... thank you for posting that link.

3CWebDev’s picture

FileSize
1.2 KB
3CWebDev’s picture

Status: Needs work » Needs review