?
avatar PhilETaylor
PhilETaylor
8 Jun 2020

Steps to reproduce the issue

Install Joomla 4.0.0 beta 1 and Testing Sample Data

Navigate on the frontend to Sample Sites in the right hand menus

then Australian Parks or Fruit Shop in the content

Expected result

No PHP errors - anything but a PHP error.

Actual result

 Argument 1 passed to Joomla\CMS\WebAsset\WebAssetRegistry::addExtensionRegistryFile() must be of the type string, null given, called in /application/libraries/src/Application/SiteApplication.php on line 173

Screenshot 2020-06-08 at 18 45 23

System information (as much as possible)

PHP 7.4.6

Additional comments

avatar PhilETaylor PhilETaylor - open - 8 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Jun 2020
avatar brianteeman
brianteeman - comment - 8 Jun 2020

All the testing data is out of date. It is not shipped with Joomla. There is already an open issue for it #25777

Please close

avatar PhilETaylor
PhilETaylor - comment - 8 Jun 2020

No I will not close this one as this is a PHP error, I'll try and replicate it another way, but ANYWAY Joomla should not be returning a PHP error.

avatar mbabker
mbabker - comment - 9 Jun 2020

Valid bug regardless of whether a reproducer can be supplied, in this case "just read the code" is the right answer.

https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Application/SiteApplication.php#L173 calls the registry's addExtensionRegistryFile method, which expects a string value and does not support null. Through a series of questionable defaults, it is possible for $component to be null, which can trigger this error. Why $component is null in the request at this point (hard to say what point it's at without a stack trace) is concerning though.

avatar SharkyKZ
SharkyKZ - comment - 9 Jun 2020

The link points to a non-existing menu item. In J3 a 404 with Component not found message is thrown.

avatar Fedik
Fedik - comment - 9 Jun 2020

well, that obviously a broken link index.php?Itemid=243
there should be 404 error,
I will do pull later to handle empty $component while addExtensionRegistryFile()

avatar SharkyKZ
SharkyKZ - comment - 9 Jun 2020

The call to addExtensionRegistryFile() should be wrapped in $component check instead. But, realistically, shouldn't the registry file be added when booting the component?

avatar Fedik
Fedik - comment - 9 Jun 2020

shouldn't the registry file be added when booting the component?

Need to keep order:
1 component registry file
2 template registry file

So template can override component assets.

avatar Fedik
Fedik - comment - 9 Jun 2020

hm, or maybe a good idea.

Split this code to 2 parts:
addExtensionRegistryFile($component) move to component booting
addTemplateRegistryFile($template->template, $this->getClientId()) move to $app->render() or something

I try to check

avatar Quy Quy - change - 9 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-09 15:14:24
Closed_By Quy
avatar Quy Quy - close - 9 Jun 2020
avatar Fedik
Fedik - comment - 9 Jun 2020

please test #29530

About my previous comment, about "Split this code to 2 parts":
I just remembered that I made in in this way to allow for plugins to do fancy stuff onBeforeRenderEvent

Add a Comment

Login with GitHub to post a comment