diff --git a/plugins/importFE/src/FatturaElettronica.php b/plugins/importFE/src/FatturaElettronica.php index 30de1d221..b03aeeec2 100644 --- a/plugins/importFE/src/FatturaElettronica.php +++ b/plugins/importFE/src/FatturaElettronica.php @@ -41,7 +41,7 @@ class FatturaElettronica if (ends_with($file, '.p7m')) { $file = XML::decodeP7M($this->file); - if ($file !== false) { + if (!empty($file)) { delete($this->file); $this->file = $file; diff --git a/src/Util/XML.php b/src/Util/XML.php index 4e116f406..ef38320d4 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -70,12 +70,12 @@ class XML $final_file = $directory.'/'.basename($file, '.p7m'); exec('openssl smime -verify -noverify -in "'.$file.'" -inform DER -out "'.$final_file.'"', $output, $cmd); - if ($cmd != 0) { + if (!file_exists($final_file)) { self::der2smime($file); $result = openssl_pkcs7_verify($file, PKCS7_NOVERIFY, '', [], '', $final_file); - if ($result == -1) { + if ($result == -1 || $result === false) { return false; } }