Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Contacts Fatal Error #20709

Closed
infograf768 opened this issue Jun 10, 2018 · 12 comments
Closed

[4.0] Contacts Fatal Error #20709

infograf768 opened this issue Jun 10, 2018 · 12 comments

Comments

@infograf768
Copy link
Member

infograf768 commented Jun 10, 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

@laoneo
Copy link
Member

laoneo commented Jun 15, 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);
}

@roland-d
Copy link
Contributor

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

@laoneo
Copy link
Member

laoneo commented Jun 15, 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.

@csthomas
Copy link
Contributor

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.

@laoneo
Copy link
Member

laoneo commented Jun 15, 2018

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

@csthomas
Copy link
Contributor

For me 2.x should be strict.

@laoneo
Copy link
Member

laoneo commented Jun 15, 2018

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

@mbabker
Copy link
Contributor

mbabker commented Jun 15, 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.

@infograf768
Copy link
Member Author

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

@brianteeman
Copy link
Contributor

has this been resolved?

@laoneo
Copy link
Member

laoneo commented Jul 26, 2018

Did #20802 fix this issue?

@infograf768
Copy link
Member Author

Closing as this has indeed been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants