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
Comments
Comment #2
idebr commentedCan you open a merge request, so the code change is tested with the phpunit tests?
Comment #4
flemming.fridthjof commentedAbsolutely, a merge request has now been created !
Comment #6
idebr commentedI 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!
Comment #8
idebr commentedThis issue is released in 8.x-2.5: https://www.drupal.org/project/views_rss/releases/8.x-2.5