2016-08-12 9:51 GMT+02:00 Lester Caine <les...@lsces.co.uk>:

> On 12/08/16 03:27, Yasuo Ohgaki wrote:
> > It sounds you are looking for autoboxing (or at least something similar)
> >
> > https://wiki.php.net/rfc/autoboxing
>
> That is interesting, and is probably something I would expect to come
> out in the wash with making a more intelligent variable. Except with
> PHP's loose casting style I would expect 'array_sum' to simply take a
> loose cast numeric version of every element. The tidy I think I am
> looking for is that 'is_num' rules on each variable would control the
> result. if any is 'null' the result is 'null' in normal SQL practice, or
> switch strict mode on and the first 'is_num' that fails throws an
> exception.
>
> > I like this proposal, BTW. I'm not sure performance impact, though.
>
> What I am still missing is an understanding of just how the global
> library of functions which act on a variable works internally with the
> 'list' of declared variables. People keep saying 'you just create a new
> object' but in my book still that object is a fixed set of code - the
> code library - and a variable set of data - the variable. Yes if the
> variable now has a flag which says 'constrained' then there will be an
> additional set of data with the constraints and as Rowan says, one has
> to decide where that is processed and what you do with the result, but
> the global code will check the 'constraint' element and see 'null' if it
> has not been processed, valid, or some failure message such as 'over
> limit'.
>
> CURRENTLY the constraint element is handled in user code working with a
> data set provided by docblock or other external storage means, SQL
> schema for example. From a performance point of view I still prefer that
> a lot of this is done in the IDE and that IS managing a lot of what we
> are talking about and has been since the 2004 date of that rfc. But
> almost every form I code on every website has a set of rules to
> constrain each input and that data needs to be used in the code to
> validate the variables being created, so isn't now the time to simply
> add global functions that provide a single built in standard for
> handling this problem?
>
> From a practical point of view of cause, the validation of inputs may
> well be done in the browser so that the constraints get passed TO some
> html5 check, or javascript function. So having uploaded the form one
> COULD simply tag a variable as valid? Or run the PHP validation as a
> safety check. All of this is workflow and that workflow could include a
> simple array function on the input array, but that still requires that
> there are a set of constraint rules for each element of the array ...
> applied to each variable ... so why can't we simply improve the variable?
>

How does it differ from userland components/libraries like:

Symfony Form https://github.com/symfony/form
ZendFramework Form https://github.com/zendframework/zend-form
Phalcon Form https://docs.phalconphp.com/en/latest/reference/forms.html

and etc. They have additional functionalities to build form but validation
looks the same you want to acheive.
If most important thing of what you want to achieve is easy to use user
input validation there are plenty of lib which does that.
There you can put build in and own constraints, validate array and retrieve
valid data.
What is the reason such feature should be built in PHP language?


>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
pozdrawiam
--
Michał Brzuchalski

Reply via email to