diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-05-30 06:57:51 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-06-04 12:02:08 +0200 |
| commit | c6e7bc150d72ce2bfba53c236cd813dbef5244ba (patch) | |
| tree | 135cae32ac0a8d676720cbc0670989a0b39ebd6b /lib/classes/exportdocument/ExportPDF.class.php | |
| parent | 0af3b594f2278e51d5a1bbc3b94eb8db07f8c4b8 (diff) | |
fixes #4221
Closes #4221
Merge request studip/studip!3064
Diffstat (limited to 'lib/classes/exportdocument/ExportPDF.class.php')
| -rw-r--r-- | lib/classes/exportdocument/ExportPDF.class.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/classes/exportdocument/ExportPDF.class.php b/lib/classes/exportdocument/ExportPDF.class.php index 8645f5b..915cfde 100644 --- a/lib/classes/exportdocument/ExportPDF.class.php +++ b/lib/classes/exportdocument/ExportPDF.class.php @@ -115,12 +115,15 @@ class ExportPDF extends TCPDF implements ExportDocument // Fetch headers from url, handle possible redirects do { $headers = get_headers($url, true, get_default_http_stream_context($url)); + if (!$headers) { + break; + } list(, $status) = explode(' ', $headers[0]); $url = $headers['Location'] ?? $headers['location'] ?? $url; } while (in_array($status, [300, 301, 302, 303, 305, 307])); - $status = $status ?: 404; + $status = $status ?? 404; // Replace image with link on error (and not internal), otherwise return sainitized // url |
