|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73425 get_headers() and default GET requests
Submitted: 2016-10-31 05:34 UTC Modified: 2018-03-25 21:23 UTC
Avg. Score:2.5 ± 1.5
Reproduced:0 of 1 (0.0%)
From: spam2 at rhsoft dot net Assigned:
Status: Open Package: Performance problem
PHP Version: 7.0.12 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-10-31 05:34 UTC] spam2 at rhsoft dot net
"By default get_headers uses a GET request" is not common sense especially when you can only change that with stream_context_set_default() other than file_get_contents which has a context param

what's the point of that insane default while no server refuses HEAD requests which are logical here by the functions name and behavior - even a httpd with <Limit GET POST> won't refuse HEAD-requests, ours are configzred that way

and no, please don't come with identical behavior and using stream wrappers for everything, when soemone wants to do that he can just achieve the same with file_get_contents which has in fact even a sane context param

what someone expects froma function called get_headers() is, well, just fetch the headers and not the body which is thrown away and if one implements such a unexpetable default it's not enough that you need to *scroll down* in teh documentation to find that out - common sense and least surprise


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-25 16:59 UTC]
FWIW, as of PHP 7.1.0, get_headers() supports an optional $context
 [2018-03-25 17:13 UTC] spam2 at rhsoft dot net
cool, thanks

whoever is adapting the manual shoul also think about the other languages and *at least* adopt the params and types on top (it's not the only function which is lacking basic infos like params over time and even wrong types are in general only fixed for the english version)
 [2018-03-25 21:23 UTC]
> it's not the only function which is lacking basic infos like
> params over time and even wrong types are in general only fixed
> for the english version

Well, the English docs are the reference, so they are written,
fixed and updated first.  The respective translation teams are
supposed to "sync with EN" as soon as time permits.  It would be
good if the translations pointed out whether they are outdated,
but unfortunately PhD does not support that yet.  Anyhow, many
translations could need some help (the German translation
certainly does!), so consider to submit patches via

FTR: the $context parameter has been documented[1], and the German
translation has been synced[2].

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jan 18 22:01:24 2021 UTC