Hello,

On 12/16/06, Andrei Zmievski <[EMAIL PROTECTED]> wrote:
Pursuant an IRC discussion with Rasmus.

It seems to be that in order to do any sort of error differentiation
we need to have a variable-level JIT decoding/filtering. It needs to
be smart though, because we want to issue errors only on the first
access to the variable. One way to approach this would be to decode/
filter the $_POST['foo'] value when it's accessed and then replace
the $_POST['foo'] with this filtered result so that the next access
gets the value directly, without invoking the JIT mechanism.

I'm not sure it is worth the effort given the possible problems like
foreach. Is it possible to add such hooks? like catch an array element
access (auto global)?
This solution looks nice but I'm unsure about its feasibility or
complexity (over designed?).

My initial thought was to decode the GPC (env, server can use this
rule as well) with the first access, no matter if the access is only
for one index $_GET['a']) or for the complete array ($a =$_POST).

The stop unicode error mode will used during the decoding phase (see
README.UNICODE for the error mode explanation). If an error occured,
the error will will be stored and can be fetched using an extra
function, like :

array = input_decoding_error($type);

where $type is one of the GPC filter constant and the returned value
is an array with the input name/error as key/value pairs.

This approach will keep the JIT system simple while having enough
flexibility. If an error occured, it is easy to see which variable was
affected. One does not even need to check it until it is done with the
input decoding process. It will also work nicely with ext/filter, if a
validation failed due to the decoding, the error can be fetched using
this function.

How does it sound?

I also like to hear other persons ideas as they wrote the JIT part or
know better the limitation of the engine (for the element access
hook), Zeev, Andi, Dmitry? :)

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to