0

I'm getting the following issue since today, i'm not able to find out what is going on. It was all working fine for the past few months, and no files was modified recently. What could be the problem? ( Unfortunately, the support from the extension provider is expired, i'm trying to resolve the problem myself.)

checked: cron jobs are running fine.

checked: ticket.php was not modified.

checked: mysql is running

error from exception log

[2020-09-14 14:15:09] main.CRITICAL: One or more input exceptions have occurred. {"exception":"[object] (Magento\\Framework\\Validator\\Exception(code: 0): One or more input exceptions have occurred. at /home/-----/public_html/app/code/Aheadworks/Helpdesk/Model/Ticket.php:246)"} []

this is the partial from ticket.php, starting from line 230

/**
 * Add cc_recepients validation to regular validation
 *
 * @return $this
 * @throws \Magento\Framework\Validator\Exception
 */
public function validateBeforeSave()
{
    try {
        parent::validateBeforeSave();
    } catch (ValidatorException $catchedException) {
    }

    if (!empty($catchedException)) {
        $validateException = $catchedException;
    } else {
        $validateException = new ValidatorException();
    }

    $this->fillFromAdminData();
    $emailRule = new \Zend_Validate_EmailAddress();
    $ccRecipients = $this->getCcRecipients() ? $this->getCcRecipients() : [];
    $emailsToValidate = array_merge([$this->getCustomerEmail()], $ccRecipients);

    foreach ($emailsToValidate as $email) {
        if (!$emailRule->isValid($email)) {
            foreach ($emailRule->getMessages() as $message) {
                $validateException->addMessage(new Error($message));
            }
        }
    }

    if (count($validateException->getMessages())) {
        throw $validateException;
    }

    return $this;
}
1

As spoken try

if (isset($catchedException) && !empty($catchedException)) { 
    $validateException = $catchedException;
} else {
    $validateException = new ValidatorException();
}
0

If php7.1 can you try this in your code?

try 
{
    parent::validateBeforeSave();
} 
catch (ValidatorException|Exception $catchedException) 
{

}
  • yes, it is php 7.1.33, updated to that, but the problem still presist. The line 246 of the erro message was referring to '$validateException = new ValidatorException();' can you show me how i can comment this validation function out? – Kris Wen Sep 16 '20 at 0:01
  • it works if i take out the if-else statement, and changed to '$validateException = new ValidatorException();' only, otherwise it is giving the error [2020-09-16 21:45:09] main.CRITICAL: Notice: Undefined variable: catchedException . Any idea? – Kris Wen Sep 16 '20 at 21:59
  • late reply sorry but you can try if (isset($catchedException) && !empty($catchedException)) { } – Nadeem Sayyed Sep 20 '20 at 21:31
  • thanks Nadeem, that works too. Please update your answer I will accept it. – Kris Wen Sep 22 '20 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.