Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129327 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 6A1C41A00BC for ; Thu, 20 Nov 2025 12:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763642597; bh=Awg+N7EV6JwJZ+5ew7VCOThxceyRumxkQv/FFGhJjCA=; h=From:Date:Subject:To:From; b=aksT4DJ3MIl85E+4kdzDtRHuB50rP49mcEKKGxAXkY8d+osanopDCmOKs7c/g90+c HN9PVTRwROq4QJHTx3g0EUull65nSw5fZ4NO6F553GbKWs0tmZvJ5sRtYJMtJJ48cl Xhf0cEw9RCHuIIlZWJcDrxLmY4G13CEwjlQLxZEvsFmEMdU6QvCEW7MTMey95BnLUg bJiLDlzABD7LrQdGqnpUQj0qUk/l/TbJaJ4wts4weBwHQJm0GOOZem91JPdT8/A0N3 EzMO9JfMtr34q/T0VjnJcObp8PaPImAgd66UjYEoXZsvNOcccM1eXCshnpFuOJ+YtN GFSnJrNuCcw3Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3217018004D for ; Thu, 20 Nov 2025 12:43:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 20 Nov 2025 12:43:16 +0000 (UTC) Received: by mail-ej1-f67.google.com with SMTP id a640c23a62f3a-b7636c96b9aso117312266b.2 for ; Thu, 20 Nov 2025 04:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grokability.com; s=google; t=1763642590; x=1764247390; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=WZLyaVHMttHzEVbXFzborw2fmGrGGOAywSJ5EYMVprc=; b=IWnV/AI3+uwKpILjUe2gt1mFObDWNs/NZa141riTH7JTlJPy7b+w3jmzoggc1SliqC RR7sIrX3lHqbIIKdXmukZtmu3vvo/2p+qrO3j03sfUhxUR/L/v/HpAEJAHFgDkJ5bHi7 f20agjhmBYGiVfsDe4QbW3pwT/mU3KJbpbAj4jpnwtSkVBFqKkIR5qvhVE66AKyU2eTx +C8OerX40vEpwQPYfGVNxQHlHjC2qFsYEnwcwH6zIaCYeJ7GZZQt1DyXK2bjhGVcS8PG ChP8bwypx6w7B0JnodVIxeN1JYqugPCzhyAg8nNqkbILS0K5t1Ksx/lmCfSMerk4Higx 34Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763642590; x=1764247390; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WZLyaVHMttHzEVbXFzborw2fmGrGGOAywSJ5EYMVprc=; b=XLsr6gh+Yh/jHamiMTxZtRmDQ9Wlo4lVsSZLChodO9vwuXMWNN2KOJpVbxUETlJXMD B1aqFj01Tzx5oDCO+m/yDtPXDOQdZVqNfuicSatJaUHaKUYB1GoOK+FHYOZi0SwPpqoe dY54F/4gAJ9Dt8KDqMZ73C2rWLabQRM2XwdHn0svUETkywkDCetrEOK4g3gijw0K0u4L ycK0RwnB7eETAQutju3xL03BVIN77HBcEIUNyyHB5XL3hO7d/j5mkRpjodBplwop7Wwl zBZKcxRsjLUKGbS4ljePCEvX2G5UYE+u+T3gMRwE8YHSXYmv8rzD/21mACBolXK0c6cl AL4g== X-Gm-Message-State: AOJu0YzS9Q73On94YsiioEkCFcM9pbqTvJ9RHvC3V6Te8wKLnqvlfKVm JJ91bbpi+msIFkJPj8PhVenLOJ4EVpvlFWgybCryd5maP7dtG8AAg1M2Ctmjf4lx91w2SVUCvfX CS1Sv2bYDFUjoX+AdR8QTGuYQQJdJAZOyGm/OnHsxbnTpjlqN08NSpCmpeSqk1Lc= X-Gm-Gg: ASbGncstaCeu2450vimSIjqwckSGWxNie1izk3HNJHIAmIuk7AuMZZtorJCGYvRZrSE Z/GcIHbFNEKglQwfH6P9GimSwS6fo2vDlKUuOG+wL4xUMnMTwevKtM4mHEPgN+t4mEOCmdggmS0 5qTxYELIZQQxCq04YI0rgpO9Dhm4PAZzucx2xokuXYuDgfYao2cv2LR7aRlqfoXMTM9bJZpWUOp ldm5idthr7YUpcrNgJzNIdI+oU5TzTKdJPK9YzNBz5NyO7PsOnHCeXlgQH19tcfWmCSujhP X-Google-Smtp-Source: AGHT+IGfAyF5o9f45FoBp2//hmWrj2gbHCCAfgcGx/Np22XfR2v1OxqylQsxXSsUlHQmImbzwAGtv6230nr+7bQJQ1A= X-Received: by 2002:a17:907:db16:b0:b73:883e:1517 with SMTP id a640c23a62f3a-b76552e3799mr292198166b.26.1763642589978; Thu, 20 Nov 2025 04:43:09 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 20 Nov 2025 12:42:58 +0000 X-Gm-Features: AWmQ_bm79VP9izECPs7O0PcLNMoMBEmKAMhDCkRLqafgUOk3uZmozOS4wdvRlXE Message-ID: Subject: [PHP-DEV] max_input_vars silently truncates input without an error message To: PHP internals Content-Type: text/plain; charset="UTF-8" From: bwetherington@grokability.com (Brady Wetherington) Hello Internals! I originally posted this to Github as an issue - https://github.com/php/php-src/issues/20456 - but someone there recommended that I post it to this list instead. Including the same content here. If you run this script: test
"; } ?>
Total test values: ".count($_REQUEST['test']).""; } ?> You end up with this: Warning: PHP Request Startup: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 Total test values: 1001 Instead of the expected: Total test values: 1200 That warning is nice and all, but in the world of modern PHP with a framework like Laravel - too much has changed or is changing, such that a default installation of at Laravel suppresses all warnings, because they've grown too noisy. My boss and I lost two days troubleshooting this, and we ended up actually mangling user data in the process. I'm wondering if there isn't a better way to handle this. I can think of a few options - 1. Get rid of the option entirely (ignoring it in php.ini). Just let people submit as much stuff as they want. I don't know enough about the technical implementation to say whether or not that's a good idea. 1.a Get rid of the option for 64-bit machines. If the hash table collision problem that is mentioned in the documentation for this setting is only ameliorated on 64-bit machines, then this might do the trick. 2. Return a 400-series code - perhaps "413 Payload Too Large". This would've allowed us to at least find the problem much sooner. 3. Return a 500-series code - I like this less, but we still would've at least found the issue if this had happened. And you could argue that it's the server's fault that it can't handle all of those variables. 4. If the problem is something to do with hash tables, maybe we can relax the variable count to only include variables with different names - permitting our very-large array to be submitted correctly? 5. Return an error instead of a warning - that would've at least shown up. 6. Something else? What I think is *not* good is just (semi-)silently truncating the input that's being submitted from the form. For our use-case, that resulted in some users actually losing data - removing group memberships for whichever of their users was at the 'end' and making it hard to change the actual permissions of the group (which show up 'after' the user list, so they were getting chopped off the end). We've worked around the problem by smashing all the values together using Javascript and submitting them as one big giant comma-delimited list, but I would much rather us not having to do that - nor do I want other developers to run into this problem and have to do similar workarounds. My C is pretty rusty, but I'm happy to try and take a swing at changing this if we can come up with a decision on which approach we think is best, if any. Thank you so much, always, for making PHP! It's been my daily-driver programming language for probably around 25 years now :) -B.