Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57221 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9114 invoked from network); 5 Jan 2012 05:02:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2012 05:02:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:58073] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/D1-28877-CCE250F4 for ; Thu, 05 Jan 2012 00:02:04 -0500 Received: by vcdn13 with SMTP id n13so136844vcd.29 for ; Wed, 04 Jan 2012 21:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=HL4N6tHATx8TMhtl51FX/49PcyHWyXYkSr/3d4SOvs0=; b=COD/7qn2lOcn/012urtCukIB6S//PkJYa2eK4HkS9pRp9E64KLzwF2LC2lbQabaQBi yDQtwjJZOY7E7iXE4moT6jNJltDbr9RSmfTMgV9QegtX9mKUAHN9BXP5rfyld+n68ItX QJ9H0kg5aDEf/JaYCWE2MY1rO6eXjoNk4BpJc= Received: by 10.220.231.136 with SMTP id jq8mr307511vcb.18.1325739721354; Wed, 04 Jan 2012 21:02:01 -0800 (PST) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.3.14 with HTTP; Wed, 4 Jan 2012 21:01:40 -0800 (PST) In-Reply-To: <4F052C10.30106@lerdorf.com> References: <4F048A03.4070408@sugarcrm.com> <4F04A172.7080509@sugarcrm.com> <4F04AA8E.6020701@sugarcrm.com> <4F04AD6D.80608@php.net> <4F04B071.8080102@php.net> <4F04B44D.6080208@thelounge.net> <4F04BCF9.30802@lerdorf.com> <4F04BF63.5060309@lerdorf.com> <4F04C427.9050202@sugarcrm.com> <4F04C920.9050105@lerdorf.com> <4F04CB0D.6040703@lerdorf.com> <4F052C10.30106@lerdorf.com> Date: Thu, 5 Jan 2012 13:01:40 +0800 X-Google-Sender-Auth: dk9eViTSWcgtNHYH-KV8FfKEAmo Message-ID: To: Rasmus Lerdorf Cc: Stas Malyshev , Ferenc Kovacs , Reindl Harald , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: another fix for max_input_vars. From: laruence@php.net (Laruence) On Thu, Jan 5, 2012 at 12:50 PM, Rasmus Lerdorf wrote: > On 01/04/2012 08:13 PM, Laruence wrote: >> On Thu, Jan 5, 2012 at 5:56 AM, Rasmus Lerdorf wrot= e: >>> On 01/04/2012 01:48 PM, Rasmus Lerdorf wrote: >>>> On 01/04/2012 01:27 PM, Stas Malyshev wrote: >>>>> Hi! >>>>> >>>>>> Right, like I said in my previous message, if this is caught by >>>>>> display_start_errors, I am ok with it. We need the default/no php.in= i >>>>>> file case to not leak information like this. >>>>> >>>>> Just checked - it does not display error if display_startup_errors if >>>>> off, does display if it's on. >>>> >>>> Right, that seems ok. The other thing is that we need to clarify that = it >>>> actually only limits the number of variables per nesting level. The >>>> current name and the description doesn't make that clear. You can stil= l >>>> send 1M post vars in a single POST if you just nest them in a 1000x100= 0 >>>> 2d array. Of course, this is likely going to hit the post_max_size >>>> limit, although many sites that do file uploads will have cranked that >>>> way up. >>> >>> Oh, and a final issue to address. >>> >>> This code: >>> >>> for($data=3D[],$i=3D0; $i<=3D999; $i++) $data[$i] =3D range(0,1001); >>> echo curl_post("http://localhost/index.php",['a'=3D>$data]); >>> >>> will spew the warning 2000 times. >>> >>> & php post.php | grep Warning | wc -l >>> 2000 >>> >> could you try with this new patch: >> https://bugs.php.net/patch-display.php?bug_id=3D60655&patch=3Dmax_input_= vars.patch&revision=3Dlatest >> ? >> >> this patch also restrict the json / serializer , =C2=A0all of them must >> less than PG(max_input_vars). >> >> and different with the fix which was commited now, =C2=A0this patch coun= t >> the num vars in a global scope, that means if there are 2 elements >> which both have 500 elements in post, =C2=A0the restriction will also >> affect, >> >> and this patch will not affect the existsing called to json or >> serializer, =C2=A0 only affect the zif_json_decode and zif_serialize, >> after patch, the serialize will have a sencode parameter :"$max_vars". >> >> and the restriction can also be closed by set max_input_vars to 0. > > Right, I don't think this is going to work. A simple 'make install' > after applying your patch fails with: > > Warning: unserialize(): Unserialized variables exceeded 1000 in > phar:///home/rasmus/php-src/branches/PHP_5_4/pear/install-pear-nozlib.pha= r/PEAR/Registry.php > on line 1145 > > Warning: unserialize(): Unserialized variables exceeded 1000 in > phar:///home/rasmus/php-src/branches/PHP_5_4/pear/install-pear-nozlib.pha= r/PEAR/Registry.php > on line 1145 > > Warning: unserialize(): Unserialized variables exceeded 1000 in > phar:///home/rasmus/php-src/branches/PHP_5_4/pear/install-pear-nozlib.pha= r/PEAR/Registry.php > on line 1145 > [PEAR] PEAR: pear.php.net/PEAR not installed > > I really don't think this manual per-feature limiting is going to cut it > here. The real problem is the predictability of the hashing which we can > address by seeding it with a random value. That part is easy enough, the Hi: that will be a better fix, we have disscussed this before in irc, I also can have a try in that way. and for this fix(in such way), to be honest, yes, this is a little ugly fix, but quick. the default 1000 is a little insufficient when counting the elements in a global scope. IMO it should set to be 4096, then I think 99% of developers will not see this warning at all. thanks > hard part is figuring out where people may be storing these hashes > externally and providing some way of associating the seed with these > external caches so they will still work. > > -Rasmus --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/