Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81617 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87561 invoked from network); 2 Feb 2015 17:19:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 17:19:09 -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 74.125.82.173 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 74.125.82.173 mail-we0-f173.google.com Received: from [74.125.82.173] ([74.125.82.173:57071] helo=mail-we0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/6B-34915-A81BFC45 for ; Mon, 02 Feb 2015 12:19:06 -0500 Received: by mail-we0-f173.google.com with SMTP id w62so40367799wes.4 for ; Mon, 02 Feb 2015 09:19:03 -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=JFtn+p25sScjQUlIc4ImnYujUcfA7TLE/fz5SVepvtw=; b=jWoZf3G/mUOJ3m9JHMFIysBQkQNHmN/1ZDhOtQuUfKHkhxZ94YvGRaW8Kx0VGf4TxH WpUdFxm9h8LnitwdwwJHfcHXVPA5S6V3u2HrSDdgqqat9hhbHwMS1dy8lOIpZa7dzSAs iyShgZrkxER0l2eHtJ4w5L9thYBAZuG/2b5TnAdG8EObjY39J/NsYArPZLnE1LlqSZEN acHJMIguHBKo7GT2ctNd/2x+6Ndyh2icTkcEZdIO4UwzMs/yh81TJcKniFCHDtHTGDoL RJJRpflrjGZSL/o1fmmPd6Rm5+QrerEKJTyoAhlbRcdTVYIFscNRFMHDosKEaEcXSK8X lJiQ== MIME-Version: 1.0 X-Received: by 10.180.205.243 with SMTP id lj19mr26411565wic.26.1422897543069; Mon, 02 Feb 2015 09:19:03 -0800 (PST) Received: by 10.180.88.33 with HTTP; Mon, 2 Feb 2015 09:19:03 -0800 (PST) In-Reply-To: References: <547CEB74.9070807@ralphschindler.com> Date: Mon, 2 Feb 2015 18:19:03 +0100 Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a11c383629b496f050e1e26bc Subject: Re: [PHP-DEV] $http_response_header From: tyra3l@gmail.com (Ferenc Kovacs) --001a11c383629b496f050e1e26bc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 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 = 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 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. > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu > bump. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --001a11c383629b496f050e1e26bc--