On Tue, Feb 3, 2015 at 10:33 AM, Julien Pauli <jpa...@php.net> wrote:
> On Mon, Feb 2, 2015 at 6:19 PM, Ferenc Kovacs <tyr...@gmail.com> wrote: > >> On Tue, Dec 2, 2014 at 11:28 AM, Ferenc Kovacs <tyr...@gmail.com> wrote: >> >> > >> > >> > On Tue, Dec 2, 2014 at 1:08 AM, Rowan Collins <rowan.coll...@gmail.com> >> > wrote: >> > >> >> On 1 December 2014 22:28:04 GMT, Ralph Schindler < >> >> ra...@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ács >> > @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 > 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. -- Ferenc Kovács @Tyr43l - http://tyrael.hu