Numeric keys on views with pager

Created on 8 February 2024, 4 months ago
Updated 27 February 2024, 3 months ago

Problem/Motivation

Using numeric keys in a view causes the pager to add more parameters exponentially.

Steps to reproduce

Create a view with a page display and a full pager. The view should have enough items to make the pager appear.
Add a numeric parameter at the end of the URL like:

https://www.domain.com/my-view?3=
Try to use the pager and you will see how the URL changes adding new parameters.
On the 6th page, you will get something like
https://www.domain.com/my-view?0=&1=&2=&3=&4=&5=&6=&7=&8=&9=&10=&11=&12=&13=&14=&15=&16=&17=&18=&19=&20=&21=&22=&23=&24=&25=&26=&27=&28=&29=&30=&31=&page=5

Proposed resolution

Change the method getUpdatedParameters in the class PagerManager to use array concatenation instead of the function array_merge

    if ($current_query = $this->pagerParams->getQueryParameters()) {
      $query = $query + $current_query;
    }
πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 12 hours ago

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024