Problem/Motivation

1) Error for view preview and PHP 8 :

TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in implode() (line 22 of web/modules/contrib/jsonapi_views/jsonapi_views.module)

See https://www.php.net/manual/en/function.implode.php
Since PHP 8.0.0 : Passing the separator after the array is no longer supported.

2) Warnings when you valide a preview with filter :

Warning: Undefined array key "sort_by" in jsonapi_views_views_preview_info_alter() (line 27 of modules/contrib/jsonapi_views/jsonapi_views.module).
Warning: Undefined array key "sort_order" in jsonapi_views_views_preview_info_alter() (line 30 of modules/contrib/jsonapi_views/jsonapi_views.module).

Steps to reproduce

1) Edit a view and see log.

2) add exposed filter fill the input and click Preview.

Proposed resolution

Change implode arguments order, and test existence of array keys.

Comments

tty11 created an issue. See original summary.

tty11’s picture

A patch for fix error and warning.

tty11’s picture

Issue summary: View changes
deciphered’s picture

Status: Active » Needs review

Tests are currently broken in Drupal 9.2, re-running in 9.1

deciphered’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

  • Deciphered committed ef59c5d on 8.x-1.x authored by tty11
    Issue #3228973 by tty11: Fix arguments order for implode and remove...
deciphered’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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