Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108657 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76297 invoked from network); 18 Feb 2020 15:18:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Feb 2020 15:18:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 636BE180210 for ; Tue, 18 Feb 2020 05:33:42 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29169 217.70.176.0/20 X-Spam-Virus: No X-Envelope-From: Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 18 Feb 2020 05:33:41 -0800 (PST) X-Originating-IP: 107.223.28.39 Received: from samurai.attlocal.net (107-223-28-39.lightspeed.nsvltn.sbcglobal.net [107.223.28.39]) (Authenticated sender: pmjones@pmjones.io) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 6F6A41C000E; Tue, 18 Feb 2020 13:33:39 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) In-Reply-To: <2868575.XpRCUmUyJT@mcmic-probook> Date: Tue, 18 Feb 2020 07:33:37 -0600 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <142F6B38-0524-4311-9350-26AD8D7DE137@pmjones.io> References: <50BD013E-CF72-414C-BBC0-A7A2E45CBDDB@pmjones.io> <3E805205-A559-44D7-98FA-960E92FE5E6E@pmjones.io> <2868575.XpRCUmUyJT@mcmic-probook> To: =?utf-8?Q?C=C3=B4me_Chilliet?= X-Mailer: Apple Mail (2.3608.60.0.2.5) Subject: Re: [PHP-DEV] RFC: Server-Side Request and Response Objects (v2) From: pmjones@pmjones.io ("Paul M. Jones") Hi C=C3=B4me, > On Feb 18, 2020, at 03:24, C=C3=B4me Chilliet = wrote: >=20 > Le jeudi 13 f=C3=A9vrier 2020, 09:16:49 CET Paul M. Jones a =C3=A9crit = : >=20 >> Yeah, naming is one of the hard problems. I considered $query as an = alternative property name for $get, but in the end, the `$_GET =3D> = $get` symmetry was too great to ignore. If others here feel that $query = is a better name for `$_GET` than $get, I will submit to consensus on = that point. >=20 > query is definitely better than get. Excellent. > Regarding post, I=E2=80=99m fine with body, parsedBody and input. >=20 > I get the idea of input to mimic php://input, but if I understand = things correctly, php://input is raw body, while $request->post is = parsed body, so naming them alike might actually cause confusion? Might, might not. I don't think there is any "good" name here, only = names that are less-bad than others. > I still do not understand this. > echo adds content to the response, it does not replace it. > So the equivalent function should be $response->addContent. >=20 > I would expect $response->setContent to replace the content. Ah, I see what you are getting at now ... > Can you explicit behavior for this: >=20 > $response->setContent("a\n"); > $response->setContent("b\n"); > $responseSender->send($response); >=20 > Compared to >=20 > echo "a\n"; > echo "b\n"; ... the output would be "b\n". As you say, setContent() replaces = whatever content is already in the ServerResponse. While the comparison = for a single echo is accurate, the comparison for multiple echoes would = be: $content =3D "a\n"; $content .=3D "b\n"; $response->setContent($content); $responseSender->send($content); Does that help to clarify? --=20 Paul M. Jones pmjones@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php