Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94782 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72216 invoked from network); 1 Aug 2016 21:29:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Aug 2016 21:29:54 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:58334] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/60-03293-B4FBF975 for ; Mon, 01 Aug 2016 17:29:51 -0400 Received: (qmail 9496 invoked by uid 89); 1 Aug 2016 21:29:43 -0000 Received: from unknown (HELO mail-qt0-f175.google.com) (yohgaki@ohgaki.net@209.85.216.175) by 0 with ESMTPA; 1 Aug 2016 21:29:43 -0000 Received: by mail-qt0-f175.google.com with SMTP id x25so112707814qtx.2 for ; Mon, 01 Aug 2016 14:29:42 -0700 (PDT) X-Gm-Message-State: AEkoouthKydxZ2Gcgp3NRVO8WkxCq04fGt0HuqrPv74ATfV5zd57Y6uY2C8oIo4fL3HIinu8fnr3x9umlVNenw== X-Received: by 10.237.35.76 with SMTP id i12mr91503403qtc.41.1470086976302; Mon, 01 Aug 2016 14:29:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.85.242 with HTTP; Mon, 1 Aug 2016 14:28:55 -0700 (PDT) In-Reply-To: References: Date: Tue, 2 Aug 2016 06:28:55 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Christoph Becker Cc: Yasuo Ohgaki , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: Adding validate_var_array()/validate_input_array() to which version? From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi Christoph, On Mon, Aug 1, 2016 at 7:08 PM, Christoph Becker 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 ? 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