Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108513 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72198 invoked from network); 12 Feb 2020 20:25:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Feb 2020 20:25:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 04399180546 for ; Wed, 12 Feb 2020 10:39:33 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f42.google.com (mail-yw1-f42.google.com [209.85.161.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Feb 2020 10:39:32 -0800 (PST) Received: by mail-yw1-f42.google.com with SMTP id n184so1345296ywc.3 for ; Wed, 12 Feb 2020 10:39:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eGAxjZdl8PkAfFeeUHoAjCPs8fDaq9ig+MRIJZ4NQSM=; b=BZg35FovADdIkIptEeR2J1Jrkoi7NBt3rbdmPYkLCXEz4Qal8NN0NjWbZltbDHEsUg UDEb94RP3STF5AyHWWNG+VEWLjDVZUjjrqCU7vSZo1AHFrJBV9ZSQPQRUur/Z14XylBy qwI/yEXo/CEJWieDFWG1B9TbsqkwCCa5VMITsqg8AWytMW7k7+A2FEcCmIDND0n2niLH SHGItSr7ih6dRazCPiYMmvHNJqsmN5NU/Xx1UXi1MWit3qxw1Yl3PqZdvD4fpRzzn75c QFVi0I4g0Y6mob/CU4JG9Bv1aySSXH4do+v00gizL13l+G7q95D3QggVpXgiQckTpu8m 5L9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=eGAxjZdl8PkAfFeeUHoAjCPs8fDaq9ig+MRIJZ4NQSM=; b=JW/rsc4apqkYAm24FG6P/ULX2a9W9VSali4ocH6V1MOlgOnCRVq3/aZCJSmcJa/P32 id3o4ddqzhusjt/Tx86uJxZJ5/+CoOW5KR9wJPo62CXsHJqgLX+OTvOwYPxS7Oaxgo7v 0Ecc/ED88XaZboqTnVkhrgd4B6fD17pWpCnsdDN+q/18Yoo1j6KXJDSc7bg5ykKcuJvL es2OJ9AseUWiLU3jYusnSYRB+o3RcWUeEygeeLY3YTlLwyDIK62+qPgk54aX6bohEZMN f+yF/o6fRqJDoauiflOjBK4LOg6bW6NsIHmQINHgReBFwtREBzCpq6cMcyj8Jtsoks6z xpeQ== X-Gm-Message-State: APjAAAX7LVL12ZUXGGZksF/kaamxt/KHYzeRLfIcgjGT6fDwje1dwTFm 1xdo/oMraffpgxPHMHfPXbAANg== X-Google-Smtp-Source: APXvYqyYw1pcT7gtIYHxhIR4OxcHlWA9284Gu9d0iO526pBYN6msDerekrOlR9xvWEuXF7fvSrYt6A== X-Received: by 2002:a81:6d4e:: with SMTP id i75mr11605342ywc.487.1581532769803; Wed, 12 Feb 2020 10:39:29 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:6580:673d:95e8:48ed? ([2601:c0:c680:5cc0:6580:673d:95e8:48ed]) by smtp.gmail.com with ESMTPSA id i2sm465459ywm.17.2020.02.12.10.39.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Feb 2020 10:39:28 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: Date: Wed, 12 Feb 2020 13:39:27 -0500 Cc: "Paul M. Jones" , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <50BD013E-CF72-414C-BBC0-A7A2E45CBDDB@pmjones.io> To: Niklas Keller X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] RFC: Server-Side Request and Response Objects (v2) From: mike@newclarity.net (Mike Schinkel) > On Feb 12, 2020, at 1:20 PM, Niklas Keller wrote: > I think the request / response API is entirely fine being solved in > userland instead of in php-src. I want to disagree in support of this RFC.=20 While is *has* been solved in userland, but it has been solved 25+ times = in 25+ different incompatible ways. This RFC would allow for a *single* = solution that is compatible across all frameworks, and frameworks could = create a shim to support their existing implementations.=20 And given that it would be in core vs. userland, this would *not* apply: = https://xkcd.com/927/ The one concern should be if there is anything about this RFC that would = make writing such a shim impossible for any framework vendor? > I think we shouldn't take over the naming of the super globals, e.g. > $_GET really contains the query parameters and has nothing to do with > GET or POST, so $request->getQueryParameter(...) would be a better > name. Please no. That is all too Java-esque verbosity. =20 Very commonly used functionality can afford to be concise like = $request->get() because it would be well-known and not have to compete = with lots of other functionality for mindshare. Thus no need for this = to be so precise and have such long names when everyone writing PHP = would soon lean what it means. > I don't see any reason to keep specials such as > $_SERVER['HTTP_X_REQUESTED_WITH'] vs. $request->requestedWith, which > is just another HTTP header. Reason: $request->requestedWith can be type-safe, something you asked = for in another context. =20 $_SERVER['HTTP_X_REQUESTED_WITH'] cannot be type safe without special = cases in the language. > The Request object should be mutable, e.g. you might want to change > the client IP to be based on a x-forwarded-header instead of the TCP > source address. I totally agree it needs to be mutable, but only prior to first use. After the first use having it be locked would gain us the benefits of = robustness that immutability can provide. -Mike=