Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106232 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6460 invoked from network); 18 Jul 2019 12:46:53 -0000 Received: from unknown (HELO mail-qt1-f181.google.com) (209.85.160.181) by pb1.pair.com with SMTP; 18 Jul 2019 12:46:53 -0000 Received: by mail-qt1-f181.google.com with SMTP id n11so26538281qtl.5 for ; Thu, 18 Jul 2019 03:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sucEypNPlpe9eKWkkvoQeyGsCvikhhU9tAngKsT8L6k=; b=Bk2fKvsVOiV4EAa/UnKlSvxOzaUOwjIk75Eo+fssWE0N8Vl0WTxfGHJuASqFjoQEOw nvP/cPPJdexbGdkciJwBA2i8rJOOVziiSvlt8lTRqEGYgPhqU6M5WURMGsVgthE63FFs uxx1jQItyCq6KbhuQLvziNv7klV4lH9C+tx43qKU0lXLDznz4I1y6G/6W5pQGsZPPAfg 1VclO7CnPHk69U9nGarBUSYGRoSCR6FI6CkCW7ncUZSb6pkhdIx87sygV0uz51BkyAq7 ldB+QoVEOMm8Vw7g3Vb3gLCZ1REaSaE5ZvpfmzADsI5JfJJav6rNrCJB4CyCINz0Ymag 4Gig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sucEypNPlpe9eKWkkvoQeyGsCvikhhU9tAngKsT8L6k=; b=sJoQvQwAzidH9cv13BAPRYe3JqcoiP2EUiGZyr+JucCt0WELugrSu+r7nQB00qHiSp OG6B8gL9wV/GLEk9Teq7ZcO6S60t7plutOvLs8GO33x58UZUxnAzd2j1PYIGTscN9XUC +zRe4rjedznUudpMJf8E9Tfc5bEnYWEdDSwFFe0X8wGdK7dYsMSNDTJtozFUGWD8z7Rc 0kky84b81TRoFdx52XNdkYberrGh0duWtULpH1BM8nb6lSDyDNitLDfxy3tp9KwzVxOo A7JYGp07bmTmzhS2WAKQLb3RnssGSTiEq/LjEXp3xyyLEvqlpT33U8jSHXy1O1fFmJ49 P7/g== X-Gm-Message-State: APjAAAXNanYttz/C1m4msRMNfPHeY/azzLHPFxtCsFM9017c8zWsqP+5 SxrCDX1pwv2lCoRibmHLMG26afiHI3+HFvDppz8= X-Google-Smtp-Source: APXvYqyxcR4FBnd3Im4oMNBviQ33K2iduzlOMFZY+4nrQ/CKvAVPYPH7b3WZgWsjJNlOMyvDBZVpPxbz2jH3n1qcWwM= X-Received: by 2002:ad4:42c6:: with SMTP id f6mr8854360qvr.196.1563444525439; Thu, 18 Jul 2019 03:08:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 18 Jul 2019 12:08:36 +0200 Message-ID: To: bishop@php.net Cc: Arnold Daniels , PHP internals Content-Type: multipart/alternative; boundary="00000000000090b276058df1cb5a" Subject: Re: [PHP-DEV] Stop replacing dots with underscores in query, post and cookie parameters for PHP 8? From: rasmus@mindplay.dk (Rasmus Schultz) --00000000000090b276058df1cb5a Content-Type: text/plain; charset="UTF-8" On Tue, Jul 16, 2019 at 2:34 PM Bishop Bettini wrote: > On Tue, Jul 16, 2019 at 3:51 AM Nikita Popov wrote: > > > On Tue, Jul 16, 2019 at 3:40 AM Arnold Daniels < > > arnold.adaniels.nl@gmail.com> > > wrote: > > > > > Hi, > > > > > > PHP replaces dots with underscores for $_GET, $_POST and $_COOKIE. This > > > behavior once made sense because of Register globals. The explanation > in > > > the manual also still implies that query and post parameters are > > converted > > > to variables (see > > > > > > https://php.net/manual/en/language.variables.external.php#language.variables.external.dot-in-names > > ). > > > Register globals has been removed since 5.4.0 and thus this behavior > > serves > > > little purpose. > > > > > > I think it would be good to remove the conversion in PHP 8, as it's a > > > general cause of confusion and annoyance for anyone who comes across > it. > > > > > > Is there a good reason to keep this behavior in PHP 8? > > > > > > > This has been discussed a few times already, and I think that everyone > > agrees that this behavior should go, but not necessarily on the migration > > path. There is an RFC here: > > https://wiki.php.net/rfc/on_demand_name_mangling > > I think that the latest version of that RFC, that basically proposes to > > drop the behavior and tell people to use a polyfill is fine. > > > > I've readied the proposal for formal discussion. As proposed: > > - PHP 8.0 will no longer mangle variable names in any super-global. > - The changelog will recommend auditing super-global access for mangled > names, and replacing with the actual variable name. > - No INI settings will engage the behavior. > - No warnings or notices will be emitted. > - A polyfill will be made available to emulate that original behavior. > - Applications requiring name mangling shall invoke the polyfill during > bootstrap phase. > > https://wiki.php.net/rfc/on_demand_name_mangling What about libraries that need to support both PHP 7 and 8? Many libraries will likely need to, potentially for a long time. How will these libraries be able to detect whether the names have been mangled or not? Libraries that "unmangle" run the risk of "unmangling" names that aren't actually mangled, and could end up mangling them instead. This is a particular concern with the proposed polyfill - if there's a polyfill that mangles the names, you can't just use something like php_version() to check if it's version 8, since the polyfill could have been applied. Maybe consider adding something like $_SERVER["REAL_HEADER_NAMES"] which, if set, will indicate the names have not been mangled? The polyfill could then unset() this value - it could even check first if the names are already non-mangled, whether this is because it's running under PHP 8, because the polyfill gets bootstrapped twice (which it'll probably need to check somehow anyway) or because somebody else polyfilled the same change in some other way. --00000000000090b276058df1cb5a--