Re: Adding validate_var_array()/validate_input_array() to which version?

From: Date: Mon, 01 Aug 2016 21:28:55 +0000
Subject: Re: Adding validate_var_array()/validate_input_array() to which version?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-94782@lists.php.net to get a copy of this message
Hi Christoph, On Mon, Aug 1, 2016 at 7:08 PM, Christoph Becker <cmbecker69@gmx.de> wrote: >> We have filter_var_array()/filter_input_array() currently. They are >> designed as filter functions. i.e. They convert offending elements to >> NULL/FALSE. Therefore, it's difficult to validate and see if inputs >> are valid with specified specifications. > > Maybe I'm missing something, but wouldn't a comparision of the original > array with the filtered array already suffice, see > <https://3v4l.org/GlT49>? It may work, but it changes data types when it's possible. Float value could be headache. https://3v4l.org/3DUmn - Comparing array by == is too slow for extensive use of validations. - "Validate and reject" is better than "Filter and accept" for most applications. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#94782) next »