[php-src] PR #26060: Fix GH-26058: filter_var_array() ignores options passed by reference
| From: | Harp404 | Date: | Fri, 04 Dec 2026 07:04:49 +0000 |
| Subject: | [php-src] PR #26060: Fix GH-26058: filter_var_array() ignores options passed by reference | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41406@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/26060
Author: Harp404
Fixes #26058.
php_filter_array_handler() checked Z_TYPE_P(arg_elm) == IS_ARRAY without
dereferencing the element. When an options entry is a reference (e.g. after
array_walk($options, fn(&$x) => $x)), the array check fails and the element is
passed as a filter ID through zval_get_long(), so the default filter runs instead of
the requested one (on 8.5+ this shows up as an "Unknown filter with ID 1" warning).
filter_input_array() goes through the same handler.
The fix dereferences arg_elm before the check. The new test covers both an options
array and a plain filter ID held by reference.
I used Claude Code (Opus 5.5) to help investigate and draft this change; I reproduced the bug and
checked the fix myself.