On Tuesday, 30 January 2024 at 08:48, Nicolas Grekas 
<nicolas.grekas+...@gmail.com> wrote:

> 
> In Symfony's HttpClient, we use stream_get_meta_data($h)['wrapper_data'] to
> access headers, so there is already a way to get them using nothing but
> local scope.
> 
> This makes me wonder why, in "rejected ideas", you wrote this?
> 
> > One suggested idea was to provide those headers via a by-reference entry
> > to the stream context.
> 
> 
> 
> Maybe we don't need anything but to promote what works already (this
> "wrapper_data" entry)?

The issue is this requires you to have a stream in the first place.
file_get_contents() doesn't return a stream, and if the request fails fopen(), 
by default, returns false.

If you do have a stream, then yes stream_get_meta_data() is better, but the 
objective of this addition is to replace the $http_request_header variable so 
that it can be removed.
This is a rather fringe feature, and thus I expect these functions to also be a 
fringe feature.

Best regards,

Gina P. Banyard

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to