Re: RFC: Server-Side Request and Response Objects (v2)

From: Date: Tue, 18 Feb 2020 09:24:52 +0000
Subject: Re: RFC: Server-Side Request and Response Objects (v2)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108652@lists.php.net to get a copy of this message
Le jeudi 13 février 2020, 09:16:49 CET Paul M. Jones a écrit : > Yeah, naming is one of the hard problems. I considered $query as an alternative property name > for $get, but in the end, the $_GET => $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. query is definitely better than get. Regarding post, I’m fine with body, parsedBody and input. 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? > > Given 'echo $content; => $response->setContent($content);', shouldn't > > this rather be something like addContent()? > > That looks like poor describing on my part in the RFC. It is more true to say that these are > equivalent: > > echo $content; > > // => > > $response->setContent($content); > $responseSender->send($response); > > I will try to make that more apparent in the RFC. 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. I would expect $response->setContent to replace the content. Can you explicit behavior for this: $response->setContent("a\n"); $response->setContent("b\n"); $responseSender->send($response); Compared to echo "a\n"; echo "b\n"; -- Côme Chilliet FusionDirectory - https://www.fusiondirectory.org

« previous php.internals (#108652) next »