No Code Attached Yet PHP 8.x
avatar brianteeman
brianteeman
29 Sep 2023

Steps to reproduce the issue

php 8.1
install the testing sample data
go to
/index.php/news-feeds-component/feed-display-module

Expected result

no errors, warnings or notices

Actual result

Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in libraries\src\Date\Date.php on line 126

image

System information (as much as possible)

Additional comments

There are quite a few closed issues about this.

avatar brianteeman brianteeman - open - 29 Sep 2023
avatar joomla-cms-bot joomla-cms-bot - change - 29 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Sep 2023
avatar Fedik Fedik - change - 30 Sep 2023
Labels Added: PHP 8.x
avatar Fedik Fedik - labeled - 30 Sep 2023
avatar richard67
richard67 - comment - 5 Oct 2023

@brianteeman Does this also happen with your PR #42000 applied?

avatar brianteeman
brianteeman - comment - 5 Oct 2023

good point I will check. Also realised later and forgot to restest but it might actually be a problem with the sample data.

avatar richard67
richard67 - comment - 5 Oct 2023

Well that was my idea, to see if it comes from sample data or from the module itself.

avatar richard67
richard67 - comment - 5 Oct 2023

Of course it still can be the one or the other when it can be reproduced with the other PR applied, but maybe it gives us a better idea where it could come from.

avatar brianteeman
brianteeman - comment - 5 Oct 2023

Found it.

avatar richard67
richard67 - comment - 5 Oct 2023

Well I would assume it is the $feed->publishedDate not being set here: https://github.com/joomla/joomla-cms/blob/5.0-dev/modules/mod_feed/tmpl/default.php#L64 .

avatar brianteeman
brianteeman - comment - 5 Oct 2023

So this is what causes the problem. Someone else can decide the best fix.

The module params in the sampledata does NOT have a value for rssdate. It should have a value of 0 or 1.

The default value for the rssdate field in the xml is 0

When the module is displayed this line checks to see if the date should be displayed

<?php if ($params->get('rssdate', 1)) : ?>

But as it has neither value it tries to display the date and its empty so you get the reported error.

This could be fixed by adding the param in the sampledata.
A feed module created in the normal way in the module manager will always be ok has it writes a default value.

But in my gut that would not be a proper fix.

avatar richard67
richard67 - comment - 5 Oct 2023
avatar richard67
richard67 - comment - 5 Oct 2023

For now I would say let's fix the sample data.

avatar brianteeman
brianteeman - comment - 5 Oct 2023

are you sure? if thats the approach then it could still happen for anyone creating modules in the same way. the testing sample data is only used internally and not on released sites so its not urgent to fix that

avatar richard67
richard67 - comment - 5 Oct 2023

are you sure? if thats the approach then it could still happen for anyone creating modules in the same way. the testing sample data is only used internally and not on released sites so its not urgent to fix that

I don't have a better idea right now. But maybe it's just because I am too tired already.

avatar richard67
richard67 - comment - 5 Oct 2023

Alternatively we could fix the module so it doesn't show call the html helper and doesn't show these dates when they are empty?

avatar richard67
richard67 - comment - 5 Oct 2023

Closing as having a pull request.

avatar richard67 richard67 - close - 5 Oct 2023
avatar richard67 richard67 - change - 5 Oct 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-10-05 19:50:49
Closed_By richard67

Add a Comment

Login with GitHub to post a comment