File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,16 @@ protected function getJSONByFopen($query)
6767 error_clear_last ();
6868
6969 $ ret = @file_get_contents ($ query );
70-
7170 if ($ ret === false ) {
72- /** NOTE: https://github.com/phpstan/phpstan/issues/3213 */
71+ $ response_headers = function_exists ('http_get_last_response_headers ' )
72+ ? http_get_last_response_headers ()
73+ /** NOTE: https://github.com/phpstan/phpstan/issues/3213 */
74+ /** @phpstan-ignore-next-line */
75+ : (isset ($ http_response_header ) ? $ http_response_header : null );
76+
7377 /** @phpstan-ignore-next-line */
74- if (isset ($ http_response_header ) && is_array ($ http_response_header )) {
75- $ error_message = $ http_response_header [0 ];
78+ if (isset ($ response_headers ) && is_array ($ response_headers )) {
79+ $ error_message = $ response_headers [0 ];
7680 if ($ error = error_get_last ()) {
7781 $ error_message = $ error ['message ' ];
7882 }
You can’t perform that action at this time.
0 commit comments