Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79376 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24699 invoked from network); 2 Dec 2014 10:28:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2014 10:28:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.175 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.175 mail-ob0-f175.google.com Received: from [209.85.214.175] ([209.85.214.175:52363] helo=mail-ob0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/6D-32869-8449D745 for ; Tue, 02 Dec 2014 05:28:24 -0500 Received: by mail-ob0-f175.google.com with SMTP id wp4so9479001obc.20 for ; Tue, 02 Dec 2014 02:28:21 -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=DXHVH7NBWPZzQhFZIbur0usG5TmMWwstrqZ649O4xSk=; b=JjeWyVFqYm2MtgUAMW9+klbU8/fkTIkK01nzpiVI5Ztjaio/eNsAnS3D9yON/efl28 I+28Y9pVkSTH1c6Jv2xt4bU5aIeS+XYRRW7NEDVXFQ/QrDDg81Jy8Uo+X+PpkyIsQJ2a JQ3gno+xQovELtTs5VgXBNn8ZB1j4uuzfKsphi8sh51hCF1UH/BPZz+p18A3Vf3wxoKt Tvihrd8uw5GnP1g/WdVSVbyB4oepPSXsmzQATZn1uJhmwuh+wVdCxP7Ec8KurkQLBwil HYX4CTnzJAB+qsrl8dDYipyppmBfTb3kNNPd5PafieHEUfzmBtGcOr7a/NEz3Gp5xj/t ewLw== MIME-Version: 1.0 X-Received: by 10.202.9.142 with SMTP id 136mr35774058oij.89.1417516100976; Tue, 02 Dec 2014 02:28:20 -0800 (PST) Received: by 10.60.37.103 with HTTP; Tue, 2 Dec 2014 02:28:20 -0800 (PST) In-Reply-To: References: <547CEB74.9070807@ralphschindler.com> Date: Tue, 2 Dec 2014 11:28:20 +0100 Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a113d1d94a987130509392f3b Subject: Re: [PHP-DEV] $http_response_header From: tyra3l@gmail.com (Ferenc Kovacs) --001a113d1d94a987130509392f3b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Dec 2, 2014 at 1:08 AM, Rowan Collins wrote: > On 1 December 2014 22:28:04 GMT, Ralph Schindler > 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 previous > >request $http_response_header. Is this behavior something we want to > >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 there > >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 o= f > headers?) > > The only other local-scope variable listed next to it in the manual [1] i= s > $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 naturally > 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. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a113d1d94a987130509392f3b--