Problem/Motivation

I am getting the following errors:

Warning: Undefined array key "#row" in views_rss_core_preprocess_views_view_rss() (line 316 of modules/contrib/views_rss/modules/views_rss_core/views_rss_core.module).
Warning: Attempt to read property "elements" on null in views_rss_core_preprocess_views_view_rss() (line 316 of modules/contrib/views_rss/modules/views_rss_core/views_rss_core.module).
Warning: foreach() argument must be of type array|object, null given in views_rss_core_preprocess_views_view_rss() (line 316 of modules/contrib/views_rss/modules/views_rss_core/views_rss_core.module).

Steps to reproduce

Not sure!

Proposed resolution

Regardless of the producing the error, it's a better approach to check if an element is set before iterating over it

Issue fork views_rss-3446813

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

doxigo created an issue. See original summary.

doxigo’s picture

Status: Active » Needs review
damienmckenna’s picture

Thanks for working that out and for doing a MR. I'll review it shortly, but it's likely safe to add to the next release.

ivnish’s picture

Status: Needs review » Needs work

Pipeline has failed phpunit test

ivnish’s picture

Status: Needs work » Reviewed & tested by the community
damienmckenna’s picture

Status: Reviewed & tested by the community » Needs work
-    if (!empty($max_pub_date)) {
+    if ($max_pub_date !== NULL) {

Per the comment above it, this line needs to check to exclude zeroes too, which is why it used !empty() before; I think it'd be fine to revert it to !empty().

ivnish’s picture

Status: Needs work » Needs review

  • damienmckenna committed 59f40d26 on 8.x-2.x
    Issue #3446813 by ivnish, doxigo, damienmckenna: Warning: Undefined...
damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.