From 22d950b4069efe559274742e9f7f3ae758214340 Mon Sep 17 00:00:00 2001 From: myphs Date: Wed, 2 Dec 2020 13:25:14 +0100 Subject: [PATCH] FIX: array out of bounds This commit fixes an array out of bounds exception or as php likes to call it: ErrorException : Trying to access array offset on value of type null This might appear in some cases. In the foreach loop the wrong array was used. Now it's replaced with the correct array. --- src/WrkLst/DocxMustache/DocxMustache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WrkLst/DocxMustache/DocxMustache.php b/src/WrkLst/DocxMustache/DocxMustache.php index 8385381..e4f51dc 100644 --- a/src/WrkLst/DocxMustache/DocxMustache.php +++ b/src/WrkLst/DocxMustache/DocxMustache.php @@ -220,7 +220,7 @@ protected function AddContentType($imageCt = 'jpeg') //check if content type for jpg has been set $i = 0; $ct_already_set = false; - foreach ($ct_file as $ct) { + foreach ($ct_file->Default as $ct) { if ((string) $ct_file->Default[$i]['Extension'] == $imageCt) { $ct_already_set = true; }