Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81700 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72451 invoked from network); 3 Feb 2015 09:39:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2015 09:39:02 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.172 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.212.172 mail-wi0-f172.google.com Received: from [209.85.212.172] ([209.85.212.172:53658] helo=mail-wi0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/48-20608-53790D45 for ; Tue, 03 Feb 2015 04:39:02 -0500 Received: by mail-wi0-f172.google.com with SMTP id h11so22769932wiw.5 for ; Tue, 03 Feb 2015 01:38:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=k20J2iGaqK9zDYzqye4bP7WTYbWAkIDfuFjjclDOnUY=; b=rrbq0u8/Eoi7es1L7GY1nW7/ikv17MDvaSia5sovfacvq5/xdK4g8McaO0PDj1yuU9 zvUnmNUGgucsj30P/pT20LwLbY77udjDkSBdstWhHDl6Lsk6JjhW3RIczL2p8x3K3Iyf pMDwUy+TBggUZCTe16Y4KdyNZbSH8UgFqZf7HFYd5qd1PWvsGu/lZp7fkNGKTsXXqbja /cGoK+/UXiCJGtTkUXqCz1imntaWyYnPFsbiq1PtIq0EE0U5dzrgyRGdVOc8dZQ7gBNR Gi3utWYUmQN67NaQCxD+2x09wk1dEJFBNmtmk7uLWuXhaxdADa0tYGmZILk4L5zmzQ5B R6uA== MIME-Version: 1.0 X-Received: by 10.194.175.102 with SMTP id bz6mr30884474wjc.120.1422956338859; Tue, 03 Feb 2015 01:38:58 -0800 (PST) Received: by 10.180.88.33 with HTTP; Tue, 3 Feb 2015 01:38:58 -0800 (PST) In-Reply-To: References: <547CEB74.9070807@ralphschindler.com> Date: Tue, 3 Feb 2015 10:38:58 +0100 Message-ID: To: Julien Pauli Cc: Rowan Collins , PHP Internals List Content-Type: multipart/alternative; boundary=089e0149365a1bd534050e2bd796 Subject: Re: [PHP-DEV] $http_response_header From: tyra3l@gmail.com (Ferenc Kovacs) --089e0149365a1bd534050e2bd796 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 3, 2015 at 10:33 AM, Julien Pauli wrote: > On Mon, Feb 2, 2015 at 6:19 PM, Ferenc Kovacs wrote: > >> On Tue, Dec 2, 2014 at 11:28 AM, Ferenc Kovacs wrote: >> >> > >> > >> > On Tue, Dec 2, 2014 at 1:08 AM, Rowan Collins >> > wrote: >> > >> >> On 1 December 2014 22:28:04 GMT, Ralph Schindler < >> >> ralph@ralphschindler.com> wrote: >> >> >Hi all, >> >> > >> >> >Many of you know from reading the subject line whats coming next! ;) >> >> > >> >> >In php, after we interact with HTTP streams (as a client), PHP >> conjures >> >> > >> >> >into local scope a variable with header information from the previou= s >> >> >request $http_response_header. Is this behavior something we want t= o >> >> >keep around into PHP 7? Or should we find a different/short-cut way = to >> >> >get the information. >> >> > >> >> >Currently, the same information can be ascertained, but only if ther= e >> >> >is >> >> >an open file handle and only through stream_get_meta_data($fh). >> >> > >> >> >It would be nice if there were an as-easy approach to getting data >> >> >without perhaps conjuring magic variables into the beloved local >> scope? >> >> > >> >> >Thoughts? >> >> >Ralph Schindler >> >> > >> >> >PS Also, do we have any other local-scope variables like this? >> >> >> >> Wow, I had no idea that existed; what an incredibly ugly >> implementation. >> >> Even the name is weird (why "header" singular when it contains an >> array of >> >> headers?) >> >> >> >> The only other local-scope variable listed next to it in the manual [= 1] >> >> is $php_errormsg, which has to be enabled with an ini setting. >> >> >> >> If the information is useful at all, then I guess a >> >> get_last_http_response_headers() function would be less magic - >> although >> >> that would presumably mean the data had to be stashed indefinitely in >> an >> >> internal global just in case it was asked for, rather than it natural= ly >> >> falling out of scope. >> >> >> >> We could just say that if you're using a shortcut like >> file_get_contents, >> >> you can't have it both ways and access metadata afterwards. It's just= a >> >> pity ext/curl is so faithful to the underlying lib, and therefore so >> >> awkward to use for simple cases. >> >> >> >> [1]: http://php.net/manual/en/reserved.variables.php >> >> >> >> >> > +1 on introducing the get_last function, and I would also suggest >> adding a >> > new ini settings similarly to track_errors so we can >> discourage/deprecate >> > the usage of this feature before removing it. >> > >> > -- >> > Ferenc Kov=C3=A1cs >> > @Tyr43l - http://tyrael.hu >> > >> >> bump. >> >> > Hey. > > About $php_errormsg , we have error_get_last(). > About $http_response_headers, we have no replacement. > > Why not get rid of both ? > I mean, those variables magically appearing into your code are born from > C, where libc usually give access to errno and errstr variables (which ar= e > often implemented as macros). > > As we are cleaning PHP and reorganizing it for PHP7, I simply would > suggest to drop support for anything like automatic magic variable > appearence. $HTTP_RAW_POST_DATA could as well disappear (made deprecated = as > of 5.6). > > Julien.P > yeah, as I mentioned I support introducing a new function for fetching the info, but I'm a bit hesitant to remove these variables before we start deprecating them both in the manual and at least the ini usage. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e0149365a1bd534050e2bd796--