J4 Issue ?
avatar infograf768
infograf768
10 Jun 2018

Steps to reproduce the issue

Multilingual: displaying a single contact which was inserted in an article via xtd (a single contact menu item works fine)
0 Argument 1 passed to Joomla\Registry\Registry::merge() must be an instance of Joomla\Registry\Registry, null given, called in /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/Model/ContactModel.php on line 118

Displaying a contact category from a List All Contact Categories menu item page
PHP Fatal error: Cannot declare class Joomla\Component\Contact\Site\Helper\Route, because the name is already in use in /Applications/MAMP/htdocs/newfolder/joomla40/components/com_contact/helper/route.php on line 23

Trying to display a Contact category from a single contact page => 404

These errors also present after merging #20692

avatar infograf768 infograf768 - open - 10 Jun 2018
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Jun 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Jun 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Jun 2018
Category com_contact
avatar brianteeman brianteeman - change - 10 Jun 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 10 Jun 2018
avatar laoneo
laoneo - comment - 15 Jun 2018

This is due the fact that the Registry class doesn't allow null values anymore. More information about this topic can be found in #20675. The consequence is that every instantiate or merge needs to be surrounded by an if block. So $registry = new Registry($value); has to become:

if ($value)
{
    $registry = new Registry($value);
}
avatar roland-d
roland-d - comment - 15 Jun 2018

@laoneo It may be another discussion but perhaps the Registry should return an empty Registry object?

avatar laoneo
laoneo - comment - 15 Jun 2018

@mbabker is here the man in charge. I really don't care at all as long as we make a proper announcement when we are more strict in J4 than J3, as this class is used widely in core and 3rd party extensions.

avatar csthomas
csthomas - comment - 15 Jun 2018

So $registry = new Registry($value); has to become:

No, constructor still allow you to put empty string or null.
Michael only want to change loadString() method.

On J4, you can use:

$registry = new Registry('');
$registry = new Registry(null);

but you can not:

$registry = (new Registry())->loadString('');
$registry = (new Registry())->loadString(null);

Take a look at the constructor at https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/vendor/joomla/registry/src/Registry.php#L65

Currently, Registry has been updated for J3.x and it is not strict, J4.x has an older version with strict code.

avatar laoneo
laoneo - comment - 15 Jun 2018

Ok then I was wrong. Not sure if Michael is pushing that change into 2.x.

avatar csthomas
csthomas - comment - 15 Jun 2018

For me 2.x should be strict.

avatar laoneo
laoneo - comment - 15 Jun 2018

As I said. I'm fine with both options. Np.

avatar mbabker
mbabker - comment - 15 Jun 2018

The CMS is behind a bit on some of the Composer dependencies in 4.0. As far as the framework repos go everything committed to master (1.x) is being merged regularly into the 2.0-dev branches, so there are few if any behavioral differences aside from intended changes. We just need to composer update things here, a lot of packages haven't been updated in a while.

avatar infograf768
infograf768 - comment - 15 Jun 2018

Small reminder: we also have the fatal error concerning the class declaration here, and same for Newsfeeds. ?

avatar brianteeman
brianteeman - comment - 20 Jul 2018

has this been resolved?

avatar laoneo
laoneo - comment - 26 Jul 2018

Did #20802 fix this issue?

avatar infograf768
infograf768 - comment - 26 Jul 2018

Closing as this has indeed been solved.

avatar infograf768 infograf768 - change - 26 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-26 09:12:05
Closed_By infograf768
avatar infograf768 infograf768 - close - 26 Jul 2018

Add a Comment

Login with GitHub to post a comment