Commit def86e5
Fix issue when http headers are already present (#843)
This fixes a regression introduced in
#841
If a process/request runs:
- file_get_contents on an HTTP URL.
- then a json-schema validation using a file://... URL as schema (not
all schema are remotely loaded)
- and `http_get_last_response_headers()` is available
Then you end up with:
- file_get_contents on the URL fills up the headers of that request
- json-schema validation loads the schema file but using file:// there
are no headers, and it seems like file_get_contents does not clear
previous headers itself
- http_get_last_response_headers() then returns the headers of the
previous request
- and then `$this->fetchContentType()` will fail unless the response
headers were of the correct `application/schema+json` mime type (which
is very unlikely).
So this PR clears the headers before we fetch the schema, to make sure
we have a clean slate. I'll probably report this to PHP as well because
IMO it is a bit surprising.
---------
Co-authored-by: Danny van der Sluijs <danny.van.der.sluijs@infi.nl>1 parent b5ab21e commit def86e5
File tree
2 files changed
+6
-0
lines changed- src/JsonSchema/Uri/Retrievers
2 files changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
0 commit comments