Created on 2 January 2025, 4 months ago

Problem/Motivation

Since 8.x-1.10, I have gotten a bunch of errors saying things like:

Warning: Undefined array key "value" in Drupal\podcast\Plugin\views\row\RssFields->render() (line 300 of /web/modules/contrib/podcast/src/Plugin/views/row/RssFields.php)

Warning: Undefined array key "value" in {closure}() (line 77 of /web/modules/contrib/podcast/podcast.module)

Warning: foreach() argument must be of type array|object, null given in {closure}() (line 74 of /web/modules/contrib/podcast/podcast.module)

Warning: Undefined array key "attributes" in {closure}() (line 74 of /web/modules/contrib/podcast/podcast.module)

Steps to reproduce

Have a podcast RSS feed that does not have the Podcasting 2.0 fields.

Proposed resolution

Create text fields and/or dropdowns) in the Views UI to enter values for the channel and items and add if statements in RssFields.php RSS.php, and podcast.module to each field to see if the field is defined.

🐛 Bug report
Status

Active

Version

1.10

Component

Code

Created by

🇺🇸United States scampbell1 New York

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @scampbell1
  • 🇺🇸United States scampbell1 New York

    I created a VERY rough patch that seems to have eliminated the PHP warnings I was seeing by adding a bunch of isset and is_null if statements.

    This is just a starting point.

  • 🇦🇺Australia kenwest

    Inspecting @scampbell1's patch I see a few issues where the fixes perhaps go too far?

    1. podcast.module
      1. Adding the test if (isset( $value['value'])) prevents $out being set. The existing test should be modified to if ($content = $value['value'] ?? "")
    2. src/Plugin/views/row/RssFields.php
      1. When adding a podcast:soundbite element, the code already skips that step when $soundbite_start is null. Setting it to "" circumvents that test and causes a podcast:soundbite element to be added to the podcast
  • Pipeline finished with Success
    3 months ago
    Total: 265s
    #409881
  • 🇦🇺Australia kenwest

    I've created an issue fork. MR 16 fixes the warning generated when viewing a podcast that has not yet had any Podcasting 2.0 elements defined

    1. podcast_process_nested_channel_element() may receive a $value without an 'attributes' element
    2. Harden podcast_process_nested_channel_element() to receive a $value without a 'value' element (unlikely but why not?)
    3. Add podcast:funding_text_field to the options array
    4. In the $form 'podcast:value_type_field' et al are nested under 'podcast:payments' but they aren't nested in $this->options
    5. The podcast:season, podcast:episode, podcast:soundbite_start, podcast:soundbite_description, podcast:soundbite_duration and podcast:person may not be set. Prevent PHP throwing warnings by testing the result of buildElementFromOptions(). Note that buildElementFromOptions() returns an array with 'key' and 'value' elements - or an empty array is there is no element.
    6. Also fixed typos - itunes:season and itunes:episode
  • Pipeline finished with Success
    3 months ago
    Total: 138s
    #409899
  • 🇦🇺Australia kenwest

    Added another commit to MR 16. Rss::buildOptionsForm() - not all $form elements have a '#type' so allow for that.

  • Pipeline finished with Success
    3 months ago
    Total: 139s
    #410250
  • 🇵🇱Poland besek

    I had the same issue - dblog was flooded with thousands of warnings. I had to downgrade module to previous version
    I'm happy to help with testing when fix is prepared

Production build 0.71.5 2024