php 8.1
install the testing sample data
go to
/index.php/news-feeds-component/feed-display-module
no errors, warnings or notices
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in libraries\src\Date\Date.php on line 126
There are quite a few closed issues about this.
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
PHP 8.x
|
good point I will check. Also realised later and forgot to restest but it might actually be a problem with the sample data.
Well that was my idea, to see if it comes from sample data or from the module itself.
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.
Found it.
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 .
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.
... or the $feed[$i]->publishedDate
here: https://github.com/joomla/joomla-cms/blob/5.0-dev/modules/mod_feed/tmpl/default.php#L100
For now I would say let's fix the sample data.
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
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.
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?
Closing as having a pull request.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-10-05 19:50:49 |
Closed_By | ⇒ | richard67 |
@brianteeman Does this also happen with your PR #42000 applied?