Problem/Motivation

When field name in "src/Plugin/views/row/RssFields.php" ends up being NULL, which is a possible case on line 227, PHP 8.5 throws a deprecation warning because of array offset on line 235 and 243.

Deprecated function: Using null as an array offset is deprecated, use an empty string instead i Drupal\views_rss\Plugin\views\row\RssFields->mapRow() (linje 235 af /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php)

#0 /app/platform_drupal_11_4_x/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
#1 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php(235): _drupal_error_handler()
#2 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php(264): Drupal\views_rss\Plugin\views\row\RssFields->mapRow()
#3 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/style/RssFields.php(548): Drupal\views_rss\Plugin\views\row\RssFields->render()
...
Deprecated function: Using null as an array offset is deprecated, use an empty string instead i Drupal\views_rss\Plugin\views\row\RssFields->mapRow() (linje 243 af /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php)

#0 /app/platform_drupal_11_4_x/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
#1 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php(243): _drupal_error_handler()
#2 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/row/RssFields.php(264): Drupal\views_rss\Plugin\views\row\RssFields->mapRow()
#3 /app/platform_drupal_11_4_x/sites/default/modules/contrib/views_rss/src/Plugin/views/style/RssFields.php(548): Drupal\views_rss\Plugin\views\row\RssFields->render()
#4 /app/platform_drupal_11_4_x/core/modules/views/src/Plugin/views/display/Feed.php(176): Drupal\views_rss\Plugin\views\style\RssFields->render()
...

Steps to reproduce

- Install Drupal 11.4 running with PHP 8.5
- Activate dblog
- Install and activate drupal/views_rss version 2.4.0
- Setup/configure a view based of row plugin "RssFields" from views_rss.
- Observe the deprecation warnings in /admin/reports/dblog and/or the message container.

Proposed resolution

See attached patch.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork views_rss-3616086

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

flemming.fridthjof created an issue. See original summary.

idebr’s picture

Version: 8.x-2.4 » 8.x-2.x-dev

Can you open a merge request, so the code change is tested with the phpunit tests?

flemming.fridthjof’s picture

Absolutely, a merge request has now been created !

idebr’s picture

Title: PHP 8.5 Using null as an array offset is deprecated » Fix PHP 8.5 deprecations
Status: Active » Fixed

I found some more PHP8.5 deprecations when functional testing. Gitlab max PHP testing is now enabled to confirm the module triggers no more PHP 8.5 deprecations, see https://git.drupalcode.org/project/views_rss/-/jobs/11483932

Thanks for your contribution!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

idebr’s picture

Status: Fixed » Closed (fixed)

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