This simple code:
var_dump(filter_var('example.com', FILTER_VALIDATE_DOMAIN));
// also
var_dump(filter_var('example.com', FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));
Returns:
Warning: filter_var() expects parameter 2 to be long, string given in [...]
But FILTER_VALIDATE_DOMAIN
seems to be a valid filter based on this page
And that is how I understand it should be used based on filter var function.
What is wrong ?
It appears FILTER_VALIDATE_DOMAIN
only exists in PHP 7+. It's only mentioned in the general changelog, not where you'd expect it. In older versions it's not defined, and PHP falls back to 'FILTER_VALIDATE_DOMAIN'
as a bare string, and you have suppressed your error reporting and aren't seeing that notice.