Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryDrawing bug fix for Issue #92 #106

Merged
merged 4 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/PhpSpreadsheet/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace PhpOffice\PhpSpreadsheet;

use ArrayObject;

/**
* Copyright (c) 2006 - 2016 PhpSpreadsheet.
*
Expand Down Expand Up @@ -2975,7 +2977,12 @@ public function __clone()
$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;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Worksheet/MemoryDrawing.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function __clone()
$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;
}
Expand Down