From 6c23de78d8a147557aa2b3cc0c154c51bb35df83 Mon Sep 17 00:00:00 2001 From: Collie-IT <40590185+Collie-IT@users.noreply.github.com> Date: Sat, 23 May 2020 12:56:26 +0200 Subject: [PATCH] Fix Warning if $relsVML->Relationship is NULL (#1420) Fix Warning if $relsVML->Relationship is NULL (#1420) --- src/PhpSpreadsheet/Reader/Xlsx.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 77035a39..797e59ea 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -1000,12 +1000,13 @@ class Xlsx extends BaseReader Settings::getLibXmlLoaderOptions() ); $drawings = []; - foreach ($relsVML->Relationship as $ele) { - if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { - $drawings[(string) $ele['Id']] = self::dirAdd($vmlRelationship, $ele['Target']); + if (isset($relsVML->Relationship)) { + foreach ($relsVML->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { + $drawings[(string) $ele['Id']] = self::dirAdd($vmlRelationship, $ele['Target']); + } } } - // Fetch VML document $vmlDrawing = simplexml_load_string( $this->securityScanner->scan($this->getFromZipArchive($zip, $vmlRelationship)),