File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,14 +173,24 @@ class DocumentStorage
173173 private function fetch ($ path )
174174 {
175175 $ url = $ this ->baseUrl . '/ ' . ltrim ($ path , '/ ' );
176+ if (defined ('PHP_VERSION_ID ' ) && \PHP_VERSION_ID >= 80400 ) {
177+ http_clear_last_response_headers ();
178+ }
176179 set_error_handler (function () {}, -1 );
177180 $ content = file_get_contents ($ url , false , $ this ->context );
178181 restore_error_handler ();
179182 if ($ content === false ) {
180183 $ details = '' ;
181- /** @var array $http_response_header */
182- if (!empty ($ http_response_header )) {
183- $ details = " - {$ http_response_header [0 ]}" ;
184+ if (defined ('PHP_VERSION_ID ' ) && \PHP_VERSION_ID >= 80400 ) {
185+ $ lastResponseHeaders = http_get_last_response_headers ();
186+ } elseif (!empty ($ http_response_header )) {
187+ $ varName = 'http_response_header ' ;
188+ $ lastResponseHeaders = $ {$ varName };
189+ } else {
190+ $ lastResponseHeaders = null ;
191+ }
192+ if (!empty ($ lastResponseHeaders )) {
193+ $ details = " - {$ lastResponseHeaders [0 ]}" ;
184194 }
185195 throw new RuntimeException ("Failed to download from {$ url }{$ details }" );
186196 }
You can’t perform that action at this time.
0 commit comments