Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27054 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89562 invoked by uid 1010); 16 Dec 2006 23:14:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89547 invoked from network); 16 Dec 2006 23:14:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2006 23:14:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=good Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.190 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 64.233.182.190 nf-out-0910.google.com Linux 2.4/2.6 Received: from [64.233.182.190] ([64.233.182.190:56591] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/4B-22993-0AD74854 for ; Sat, 16 Dec 2006 18:14:11 -0500 Received: by nf-out-0910.google.com with SMTP id l35so1624591nfa for ; Sat, 16 Dec 2006 15:13:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QcKCRTSAwLeMYaL25A4wxJaJnPF85SFyBcVBGnwuImagZ50X0dguaEoxFQDaTmMFqc5WWrZkWQVR8yfGxCPgBe0pgTjhLZ3eD5HccTdbWraxEfF0HAFq1Nee1OjlPNAz4jHuJ4vSscDHJtjFlz2str7Gn3agBNm8SF1F2OlGoZs= Received: by 10.78.170.17 with SMTP id s17mr828324hue.1166310813588; Sat, 16 Dec 2006 15:13:33 -0800 (PST) Received: by 10.78.122.4 with HTTP; Sat, 16 Dec 2006 15:13:33 -0800 (PST) Message-ID: Date: Sun, 17 Dec 2006 00:13:33 +0100 To: "Andrei Zmievski" Cc: "Rasmus Lerdorf" , "Rui Hirokawa" , "PHP internals" , "Andi Gutmans" , "Zeev Suraski" , "Dmitry Stogov" In-Reply-To: <8E9680A2-042A-4C54-9E64-2522CCB9D4B9@gravitonic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061216131857.5001.RUI_HIROKAWA@ybb.ne.jp> <45838527.3050606@lerdorf.com> <8E9680A2-042A-4C54-9E64-2522CCB9D4B9@gravitonic.com> Subject: Re: [PHP-DEV] php6: input encoding, filter and making JIT really JIT From: pierre.php@gmail.com (Pierre) Hello, On 12/16/06, Andrei Zmievski 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