skip to Main Content

The documentation page for Types of filters does not list Validate Filters and the page that used to contain documentation for the Validate Filters e.g. FILTER_VALIDATE_INT does not seem to exist anymore.

Did PHP remove the Validate Filters? Are they planning to remove these in the future?

I have looked through the PHP 8.4.1 release notes and I don’t see any mention of this.

My server is running 8.2 and it seems to support these filters just fine.

2

Answers


  1. The PHP docs still mention them in an example as

    $var = filter_var('0755', FILTER_VALIDATE_INT, $options);
    

    There is an issue here for the documentation issue you have asked about. So it is likely a documentation issue, not a removal of the feature.

    Login or Signup to reply.
  2. No, PHP did not remove the validation filters. It can be quite obviously verified by trying it in the latest PHP version and seeing that it works.

    The reason why you cannot find them under the specified link is because a decision was made to integrate the information from this page into Predefined Constants. All filters can now be found in a single place. The old page suffered from many issues such as outdated information and broken table layout.

    The PHP language has a very strict approach to removing stuff. First, it gets a deprecation notice, and only after a few years is the feature removed. The documentation will still list it for a few more years after it has been removed, so obviously, disappearing from the documentation doesn’t mean it’s gone from the language.

    There are no plans to remove validation filters in the future. If anything, the sanitization filters are more likely to disappear as they are complete nonsense. The validation filters are mostly ok.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search