Infinite loop in get_arguments_tokens()

Created on 7 April 2025, 10 days ago

Problem/Motivation

The get_arguments_tokens() function uses a while loop to iterate over argument handlers:

while ($this->view->display_handler->get_handlers('argument')) {
  ...
}

This results in an infinite loop because get_handlers() returns a cached array of handlers that is never modified inside the loop.

The change was introduced as part of cleanup in issue #3386717, but was likely not intended.

---

Steps to reproduce

1. Create a view with at least one contextual filter (argument).
2. Set "Link display" to "Custom URL"
3. Observe the request hanging or exhausting memory due to an infinite loop.

---

Proposed resolution

Replace the while loop with a for loop to properly iterate over the static list of argument handlers. For example:

$arguments = $this->view->display_handler->get_handlers('argument') ?? [];
$num_arguments = count($arguments);
for ($i = 0; $i < $num_arguments; $i++) {
...
}
πŸ› Bug report
Status

Needs review

Version

3.30

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States xlin1003

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

Comments & Activities

Production build 0.71.5 2024