diff --git a/src/PhpSpreadsheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet.php index 65219664..4111bddb 100644 --- a/src/PhpSpreadsheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet.php @@ -2,6 +2,8 @@ namespace PhpOffice\PhpSpreadsheet; +use ArrayObject; + /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -2975,7 +2977,12 @@ class Worksheet implements IComparable $newCollection->copyCellCollection($this); $this->cellCollection = $newCollection; } elseif ($key == 'drawingCollection') { - $newCollection = clone $this->drawingCollection; + $newCollection = new ArrayObject(); + foreach ($this->drawingCollection as $id => $item) { + if (is_object($item)) { + $newCollection[$id] = clone $this->drawingCollection[$id]; + } + } $this->drawingCollection = $newCollection; } elseif (($key == 'autoFilter') && ($this->autoFilter instanceof Worksheet\AutoFilter)) { $newAutoFilter = clone $this->autoFilter; diff --git a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php index 130f0129..4011aa59 100644 --- a/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php +++ b/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -197,7 +197,7 @@ class MemoryDrawing extends BaseDrawing implements \PhpOffice\PhpSpreadsheet\ICo $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { - $this->$key = clone $value; + $this->$key = unserialize(serialize($value)); } else { $this->$key = $value; }