Skip to content

Commit 01bb1d8

Browse files
authored
Merge pull request #244 from mikehaertl/137-pdf-reference
Issue #137 Prevent destructor called too early on chained PDFs
2 parents 431cc6c + e8fca99 commit 01bb1d8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Pdf.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ class Pdf
7676
protected $_dataFields_utf8;
7777

7878
/**
79-
* @var Pdf|null if the input was an instance, we keep a reference here, so
80-
* that it won't get unlinked before this object gets destroyed
79+
* @var Pdf[]|null if the input was an instance, we keep a reference here,
80+
* so that it won't get unlinked before this object gets destroyed
8181
*/
82-
protected $_pdf;
82+
protected $_pdfs;
8383

8484
/**
8585
* @param string|Pdf|array $pdf a pdf filename or Pdf instance or an array
@@ -124,7 +124,7 @@ public function addFile($name, $handle = null, $password = null)
124124
}
125125
if ($name instanceof Pdf) {
126126
// Keep a reference to the object to prevent unlinking
127-
$this->_pdf = $name;
127+
$this->_pdfs[] = $name;
128128
if (!$name->getCommand()->getExecuted()) {
129129
// @todo: Catch errors!
130130
$name->execute();

0 commit comments

Comments
 (0)