Skip to content

[Sync-En] filter: add examples and document the exceptions of the filter functions - #1790

Merged
mmalferov merged 11 commits into
php:masterfrom
lacatoire:sync-en/1694
Nov 20, 2026
Merged

mmalferov merged 11 commits into
php:masterfrom
lacatoire:sync-en/1694

Conversation

@lacatoire

@lacatoire lacatoire commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Syncs the five reference/filter/functions/ pages filter-input-array.xml, filter-var-array.xml, filter-var.xml, filter-input.xml and filter-has-var.xml with php/doc-en#5267, php/doc-en#5699, php/doc-en#6011 and php/doc-en#6090.

filter_input_array():

  • The return value is described accurately: null is returned when the input array is not populated, regardless of FILTER_NULL_ON_FAILURE; missing entries are null when add_empty is true and omitted when it is false, and unlike filter_input() the flag does not change that; with FILTER_FORCE_ARRAY a failure value is wrapped in a one element array like any other result.
  • The RU-only example, a leftover from a version of the English page that no longer has it, is replaced by the three upstream examples: filtering GET input with a failing entry, filtering POST data with a missing field, and requesting an input type that is not populated.
  • Mirrors the removal of the two empty xi:fallback elements.

filter_var_array():

  • The return value section gains the missing-entry and failure-value paragraphs, matching filter_input_array().
  • The first example gains the note that entries are filtered as scalars unless FILTER_REQUIRE_ARRAY or FILTER_FORCE_ARRAY is used, so the FILTER_REQUIRE_SCALAR flag in it only states the default explicitly.
  • Adds the "single filter for all values" and FILTER_CALLBACK examples.
  • Two wording fixes in the options description: the key corresponds to a key in the input array, and 'flags' specifies any flags that apply.

Also removed the trailing ?> from the examples and aligned example titles and a few wordings with the glossary.

php/doc-en#6090: the five pages gain an errors section and the 8.0.0 changelog rows for the ValueError and TypeError, and, as of 8.5.0, the Filter\FilterFailedException of FILTER_THROW_ON_FAILURE.

php/doc-en#6011: filter_var() gains the two examples on checking the result of validation.

EN-Revision bumped to d5e14b9107cacb7d7257ebcf4beec48e0ea741bc on the five files.

Fixes: #1694
Fixes: #1997
Fixes: #2082

@lacatoire
lacatoire requested a review from a team as a code owner August 31, 2026 11:28
@lacatoire lacatoire changed the title [Sync-EN] Add examples for filter_var_array() and filter_input_array() [Sync-En] filter: add examples and document the exceptions of the filter functions Nov 17, 2026
@mmalferov
mmalferov merged commit a97d97d into php:master Nov 20, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants