Jump to content

Recommended Posts

Am urmatoarea eroare in modulul mobilpay, prestashop 1.5.6.2

Ceva sfat? Multumesc.

Notice: Undefined variable: e in /home/.../public_html/modules/mobilpay_cc/mobilpay_cc.php on line 428

Iar linia 428 si dupa este asa:

 if(!($e instanceof Exception)) 
    {
      $smarty->assign(array(
      'data' => $objPmReqCard->getEncData(),
      'env_key' => $objPmReqCard->getEnvKey(),
      'paymentUrl' => $paymentUrl
      ));
    }

 

Share this post


Link to post
Share on other sites

Este proasta practica sa neglijezi notificarile pe ideea ca nu sunt erori. Indiferent ce sunt, genereaza consum suplimentar de resurse si mesaje ce pot incurca raspunsurile serverului cand se lucreaza cu AJAX.

@levviking Pentru o modificare minima poti adauga o verificare in linia 428, ceva de genul

if(isset($e) && !($e instanceof Exception))

Sau poti repara logica: daca apare o exceptie se executa codul din

        } catch (Exception $e) {
            $error = $e->getMessage();
            $errors = explode("\n", $error);//just first line
            $smarty->assign(['errors' => $errors]);
            return '';
            //return $this->display(__FILE__, 'validation.tpl');
        }

(v1.0.0 a modulului, nu cred ca exista altceva), care opreste functie si returneaza un sir gol (observi ca este acelasi cod cu cel din else, linia 434, cred). Deci nu mai are sens testarea din linia 428, daca am ajuns acolo e clar ca nu exista $e. Asa ca blocul if-else

        if (!($e instanceof Exception)) {
            $smarty->assign([
                'data' => $objPmReqCard->getEncData(),
                'env_key' => $objPmReqCard->getEnvKey(),
                'paymentUrl' => $paymentUrl
            ]);
        } else {
            $error = $e->getMessage();
            $errors = explode("\n", $error);//just first line
            $smarty->assign(array('errors' => $errors));

            return '';
            //return $this->display(__FILE__, 'validation.tpl');
        }

poate fi corectat/simplificat in

        //if (!($e instanceof Exception)) {
            $smarty->assign([
                'data' => $objPmReqCard->getEncData(),
                'env_key' => $objPmReqCard->getEnvKey(),
                'paymentUrl' => $paymentUrl
            ]);
        //} else {
        //    $error = $e->getMessage();
        //    $errors = explode("\n", $error);//just first line
        //    $smarty->assign(array('errors' => $errors));

        //    return '';
        //    //return $this->display(__FILE__, 'validation.tpl');
        //}

 

LATER EDIT: nu cred ca va exista o versiune actualizata a modulului, asa ca este destul de sigur sa faci modificarile direct in modul, Daca vrei vrei sa fii absolut sigur, fa un override la modul.

Share this post


Link to post
Share on other sites

Mersi de sfaturi. Am incercat dar mi-a dat eroare 500. Probabil ceva nu am modificat corect. Mai incerc diseara.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More