On Thu, Apr 8, 2021 at 2:41 PM Michael Maroszek <par...@gmail.com> wrote:

> Dear Internals,
> I'd like to suggest a new enhancement for 8.1 as outlined in the title.
>
> The initial pull request is here:
> https://github.com/php/php-src/pull/6834/files
>
> --- Details:
> Since quite a while PHP offers a dedicated user_agent php.ini entry, but it
> affects only all internal implementations like file_get_contents. cURL has
> no default and you need to modify CURLOPT_USERAGENT in the code and for the
> SoapClient there is a parameter 'user-agent' in the constructor which can
> be set.
>
> Therefore I'd like to introduce an equal entry for curl.user_agent which
> would set a default user_agent when making curl requests. Of course you can
> override it with CURLOPT_USERAGENT if required. (I can implement the same
> for SoapClient, if requested)
>
> --- Alternative:
> I could also use the default user_agent entry, but I wasn't sure what the
> best practise is and went for the more "local" approach for the initial
> implementation.
>
> --- Bigger picture:
> When the preferred solution is to use the default user_agent, we could also
> try to determine more places where i could send the default user_agent to
> give this php.ini entry a more consistent feeling.
>
> Thanks for your consideration,
> Michael
>

Could you please describe what your use case for this change is?

I'm generally not a fan of adding more ini settings (aka global state)
without a strong motivation, and it's not immediately obvious what that
motivation is in this case. This seems useful if you have both a) one user
agent you want to use for everything and b) a lot of heterogeneous code
that doesn't use any common abstraction, which seems like a rather odd
situation to be in.

Regards,
Nikita

Reply via email to