Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100379 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8207 invoked from network); 5 Sep 2017 11:19:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2017 11:19:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; 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:51008] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/B5-04538-8288EA95 for ; Tue, 05 Sep 2017 07:19:08 -0400 Received: (qmail 18624 invoked by uid 89); 5 Sep 2017 11:19:00 -0000 Received: from unknown (HELO mail-io0-f170.google.com) (yohgaki@ohgaki.net@209.85.223.170) by 0 with ESMTPA; 5 Sep 2017 11:19:00 -0000 Received: by mail-io0-f170.google.com with SMTP id q64so14359192iod.5 for ; Tue, 05 Sep 2017 04:18:59 -0700 (PDT) X-Gm-Message-State: AHPjjUiA0BYNQkMksuZR8uMCQ7uWrB2Rw7NdgaWVwAtKFJ+KDV7AVd5E EsSQqBm1zgAn4XsHHvpaHMvyYRwVMA== X-Google-Smtp-Source: ADKCNb7dCs0CNliRrov8SgnA8yzJ2MOrPxUNMyYfJ53Ea11O4h1lV2T3oOt2wz0f3mdFoyaTO3On5fuzNieN2mwkjcg= X-Received: by 10.107.29.212 with SMTP id d203mr3401321iod.201.1504610334028; Tue, 05 Sep 2017 04:18:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.72.5 with HTTP; Tue, 5 Sep 2017 04:18:13 -0700 (PDT) In-Reply-To: <0C7F986C-B0BC-4315-98ED-B4FD003B9399@gmail.com> References: <0C7F986C-B0BC-4315-98ED-B4FD003B9399@gmail.com> Date: Tue, 5 Sep 2017 20:18:13 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Paul Jones Cc: Marco Pivetta , Crocodile , Rowan Collins , "internals@lists.php.net" Content-Type: multipart/alternative; boundary="001a1140a3b47c3d6a05586f6434" Subject: Re: [PHP-DEV] A validator module for PHP7 From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1140a3b47c3d6a05586f6434 Content-Type: text/plain; charset="UTF-8" Hi all, On Tue, Sep 5, 2017 at 12:19 PM, Paul Jones wrote: > > > On Sep 4, 2017, at 18:06, Marco Pivetta wrote: > > > > On Mon, Sep 4, 2017 at 8:56 PM, Crocodile wrote: > > > >> In most cases users would like more than just valid/invalid, i. e. which > >> particular rule(s) failed and also human-readable error messages. As of > >> simple validation that is almost always at hand, filter_* functions do a > >> good job, although I agree that they could be better. I, for one, would > >> like to see a full-featured validation as part of PHP. However, this RFC > >> only looks like a slightly better version of filter_* functions, that > is, > >> the new module will provide almost the same functionality but with a > >> different interface. I would vote against it. > >> > > > > And also, it would need to be better than all of these to be worth > writing > > it in C: > > > > https://packagist.org/search/?q=validator > > And these as well: https://packagist.org/search/?q=filter I cannot guess people's thought. I appreciated feedback! Why do you think basic validation module should be better than full OO implementation(s)? Simple and basic type support NULL/BOOL/INT/FLOAT/STRING/ARRAY/OBJECT is enough for C written PHP module. IMHO, PHP modules are better of to provide basic features that may be extended by user scripts. I picked 1st one on the list as an example. This kind of rule construction is inefficient compare to simple array rules, so I doubt this is the way for basic validator module written by C. $validator = Validation::createValidator(); $violations = $validator->validate('Bernhard', array( new Length(array('min' => 10)), new NotBlank(), )); However, this particular validation class seems it could be good one that wraps validate module for nicer OO API and faster execution. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1140a3b47c3d6a05586f6434--