protected $_parts = array();
/**
- * Information/Statistics on the subpart.
- *
- * @var array
- */
- protected $_information = array();
-
- /**
* The MIME ID of this part.
*
* @var string
protected $_basepart = false;
/**
+ * Function to run on serialize().
+ */
+ public function __sleep()
+ {
+ if (!empty($this->_contents)) {
+ $this->_contents = $this->_readStream($this->_contents, true);
+ }
+
+ return array_diff(array_keys(get_class_vars(__CLASS__)), array('defaultCharset', 'memoryLimit', 'encodingTypes', 'mimeTypes'));
+ }
+
+ /**
+ * Function to run on unserialize().
+ */
+ public function __wakeup()
+ {
+ if (!empty($this->_contents)) {
+ $this->setContents($this->_contents);
+ }
+ }
+
+ /**
* Set the content-disposition of this part.
*
* @param string $disposition The content-disposition to set (inline or
*/
public function transferEncodeContents()
{
- if (!$this->_contents) {
+ if (empty($this->_contents)) {
return;
}
*/
public function transferDecodeContents()
{
- if (!$this->_contents) {
+ if (empty($this->_contents)) {
return;
}
$newfp = $this->_writeStream($parts);
array_map('fclose', $parts_close);
- return $stream ? $newfp : $newfp->readStream($newfp);
+ return $stream ? $newfp : $this->_readStream($newfp);
}
/**
}
/* Make sure the message has a trailing newline. */
- $msg = $this->toString(false, true);
+ $msg = $this->toString(false);
if (substr($msg, -1) != "\n") {
$msg .= "\n";
}