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++) {
...
}
CommentFileSizeAuthor
#2 views--infinite-loop-3517834-2.patch1.33 KBxlin1003

Comments

xlin1003 created an issue. See original summary.

xlin1003’s picture

StatusFileSize
new1.33 KB

Patch attached to switch to for loop

jose reyero’s picture

Thanks, it works.

Not sure about php requirements though, it will be PHP7.4 for this code... (?)