Fix assert() in lib
[MAILPOET-4258]
This commit is contained in:
@@ -12,7 +12,6 @@ use MailPoet\Entities\NewsletterEntity;
|
||||
use MailPoet\Entities\ScheduledTaskEntity;
|
||||
use MailPoet\Entities\SubscriberEntity;
|
||||
use MailPoet\Logging\LoggerFactory;
|
||||
use MailPoet\Mailer\MailerError;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Mailer\MetaInfo;
|
||||
use MailPoet\Models\Newsletter;
|
||||
@@ -423,7 +422,6 @@ class SendingQueue {
|
||||
// log error message and schedule retry/pause sending
|
||||
if ($sendResult['response'] === false) {
|
||||
$error = $sendResult['error'];
|
||||
assert($error instanceof MailerError);
|
||||
$this->errorHandler->processError($error, $sendingTask, $preparedSubscribersIds, $preparedSubscribers);
|
||||
} elseif (!$sendingTask->updateProcessedSubscribers($preparedSubscribersIds)) { // update processed/to process list
|
||||
MailerLog::processError(
|
||||
|
@@ -3,8 +3,6 @@
|
||||
namespace MailPoet\Doctrine;
|
||||
|
||||
use MailPoetVendor\Doctrine\Common\Cache\CacheProvider;
|
||||
use MailPoetVendor\Doctrine\ORM\Mapping\ClassMetadata as DoctrineClassMetadata;
|
||||
use MailPoetVendor\Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetadata;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
|
||||
@@ -44,8 +42,7 @@ class MetadataCache extends CacheProvider {
|
||||
// in dev mode invalidate cache if source file has changed
|
||||
if ($fileExists && $this->isDevMode) {
|
||||
$classMetadata = unserialize((string)file_get_contents($filename));
|
||||
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
||||
if (!class_exists($classMetadata->name) && !interface_exists($classMetadata->name)) {
|
||||
if (!isset($classMetadata->name) || (!class_exists($classMetadata->name) && !interface_exists($classMetadata->name))) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
|
@@ -101,12 +101,16 @@ class Bridge {
|
||||
return $wp->wpRemoteRetrieveResponseCode($result) === 200;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return API
|
||||
*/
|
||||
public function initApi($apiKey) {
|
||||
if ($this->api) {
|
||||
if ($this->api instanceof API) {
|
||||
$this->api->setKey($apiKey);
|
||||
} else {
|
||||
$this->api = new Bridge\API($apiKey);
|
||||
}
|
||||
return $this->api;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,9 +118,7 @@ class Bridge {
|
||||
* @return API
|
||||
*/
|
||||
public function getApi($key) {
|
||||
$this->initApi($key);
|
||||
assert($this->api instanceof API);
|
||||
return $this->api;
|
||||
return $this->initApi($key);
|
||||
}
|
||||
|
||||
public function getAuthorizedEmailAddresses($type = 'authorized'): array {
|
||||
|
Reference in New Issue
Block a user