Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81699 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70875 invoked from network); 3 Feb 2015 09:34:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2015 09:34:43 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wg0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:47606] helo=mail-wg0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/F7-20608-03690D45 for ; Tue, 03 Feb 2015 04:34:41 -0500 Received: by mail-wg0-f42.google.com with SMTP id x13so43583545wgg.1 for ; Tue, 03 Feb 2015 01:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=9ZlmXGz//nE6jUUYZhWWTHZHC37hr1jLJTgrefpHu1o=; b=ADXejrnmg+CWuLzKAgKkzgjJFW/Ef4Lq3+q3fPT6SsLddT9KUkxL5M2i6C0Xj1T3MH o7ciJsb8YGCZDmQCarxHLfzUEMjspKzPw7ximgggfv8vNjSaOV/C0IWDNE65Z7JSNQUJ h9ARFf5HRsZO7DHC/QdwdU031uCOuFJOjLNa5xM3CpHbluONNYKLsl7nv0z8/2XsBkfV bYXQQITsQ6sFEfKQkt+9+KT6exuY4SwZDgvHRSU9A7Wz4yuC74HOnaQu5gc9crPSytwh 3fUlQC+tU0mwbEY70J0Xh3NupibfuOjqjqNXSFxWgyKH+1kqXvLHvMttRIzdRfrMMzep zbKg== X-Received: by 10.180.206.14 with SMTP id lk14mr32171122wic.71.1422956077495; Tue, 03 Feb 2015 01:34:37 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.94.137 with HTTP; Tue, 3 Feb 2015 01:33:57 -0800 (PST) In-Reply-To: References: <547CEB74.9070807@ralphschindler.com> Date: Tue, 3 Feb 2015 10:33:57 +0100 X-Google-Sender-Auth: ODSxA1v51LwS3vb2aFMT1cOO6Lg Message-ID: To: Ferenc Kovacs Cc: Rowan Collins , PHP Internals List Content-Type: multipart/alternative; boundary=001a11c38dac87bb34050e2bc77b Subject: Re: [PHP-DEV] $http_response_header From: jpauli@php.net (Julien Pauli) --001a11c38dac87bb34050e2bc77b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 conjur= es > >> > > >> >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 t= o > >> >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 scop= e? > >> > > >> >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 implementatio= n. > >> Even the name is weird (why "header" singular when it contains an arra= y > 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 - althou= gh > >> 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 naturall= y > >> 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 addin= g > a > > new ini settings similarly to track_errors so we can discourage/depreca= te > > 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 are 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 --001a11c38dac87bb34050e2bc77b--