This commit is contained in:
the-djmaze 2022-04-21 01:27:12 +02:00
parent 0256f05e7d
commit fd28741cb8
2 changed files with 15 additions and 2 deletions

View file

@ -57,6 +57,11 @@ class Literal
return \fopen(self::STREAM_NAME.'://'.$sHashName, 'rb');
}
public function stream_cast(int $cast_as) /*: resource*/
{
return false; // $this->rStream;
}
public function stream_open(string $sPath) : bool
{
$this->iPos = 0;

View file

@ -720,7 +720,7 @@ class GPG
protected function _sign(/*string|resource*/ $input, /*string|resource*/ $output = null, bool $textmode = true) /*: string|false*/
{
if (!$this->hasSignKeys()) {
if (empty($this->signKeys)) {
throw new \Exception('No signing keys specified.');
}
@ -904,6 +904,14 @@ class GPG
private function setInput(&$input) : void
{
if (\is_resource($input)) {
// https://github.com/the-djmaze/snappymail/issues/331
// $meta['stream_type'] == MEMORY or $meta['wrapper_data'] == MailSo\Base\StreamWrappers\Literal
$meta = \stream_get_meta_data($input);
if ('STDIO' != $meta['stream_type']) {
$input = \stream_get_contents($input);
}
}
$this->_input =& $input;
}
@ -1150,7 +1158,7 @@ class GPG
$inputStreams,
$outputStreams,
$exceptionStreams,
null
5
);
$this->_debug('=> got ' . $ready);