Skip to content
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
4 changes: 3 additions & 1 deletion lib/Horde/Mime/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public function toArray(array $opts = [])
$tmp = [];

foreach ($ob->sendEncode(array_filter($sopts)) as $val) {
$val = $val ?? '';

if (empty($opts['nowrap'])) {
/* Remove any existing linebreaks and wrap the line. */
$htext = $ob->name . ': ';
Expand Down Expand Up @@ -509,7 +511,7 @@ public function offsetUnset($offset)
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->_headers);
return new ArrayIterator((array) $this->_headers);
}

/* Deprecated functions */
Expand Down
2 changes: 0 additions & 2 deletions lib/Horde/Mime/Magic.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ public static function analyzeFile(

if ($res) {
$type = trim(finfo_file($res, $path));
finfo_close($res);

/* Remove any additional information. */
if (empty($opts['nostrip'])) {
Expand Down Expand Up @@ -219,7 +218,6 @@ public static function analyzeData(
}

$type = trim(finfo_buffer($res, $data));
finfo_close($res);

/* Remove any additional information. */
if (empty($opts['nostrip'])) {
Expand Down
20 changes: 9 additions & 11 deletions lib/Horde/Mime/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,17 @@ public function send($mailer, $resend = false, $flowed = true)
*/
public function getRaw($stream = true)
{
if ($stream) {
$hdr = new Horde_Stream();
$hdr->add($this->_headers->toString(), true);
return Horde_Stream_Wrapper_Combine::getStream(
[$hdr->stream,
$this->getBasePart()->toString(
['stream' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY]
),
]
);
$raw = $this->getBasePart()->toString([
'stream' => $stream,
'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY,
'headers' => $this->_headers,
]);

if ($stream && is_resource($raw)) {
rewind($raw);
}

return $this->_headers->toString() . $this->getBasePart()->toString();
return $raw;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Mime/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ public function toString($options = [])
* Get the transfer encoding for the part based on the user requested
* transfer encoding and the current contents of the part.
*
* @param integer $encode A mask of allowable encodings.
* @param int|null $encode A mask of allowable encodings.
*
* @return string The transfer-encoding of this part.
*/
Expand Down
Loading