Jump to content

[PrestaShop] Fatal error in module file :/home/key2015/public_html/classes/module/Module.php(1361) : eval()'d code: syntax error, unexpected 'use' (T_USE)


keygadgetz

Recommended Posts

please see below error. it not allow me to use module anymore. i have trying to add 2checkout payment gateway on it and while adding it this error occurred. 

can you please help me to solve this error.

 

[PrestaShop] Fatal error in module file :/home/key2015/public_html/classes/module/Module.php(1361) : eval()'d code:
syntax error, unexpected 'use' (T_USE)

 

thanks you

Harsha

Link to comment
Share on other sites

Your problem description is a bit summary. 

 - provide your Prestashop version

 - have a look what is on line 1361 of Module.php and include it in your question. When you make life easy for the people who are here to answer your questions your chances to get an answer increase..

Link to comment
Share on other sites

On 1/23/2021 at 6:17 PM, musicmaster said:

Your problem description is a bit summary. 

 - provide your Prestashop version

 - have a look what is on line 1361 of Module.php and include it in your question. When you make life easy for the people who are here to answer your questions your chances to get an answer increase..

Prestashop 1.6.1.22

Link to comment
Share on other sites

21 hours ago, musicmaster said:

And what is on line 1361?

    1359                // If (false) is a trick to not load the class with "eval".
      1360              // This way require_once will works correctly
          1361          if (eval('if (false){    '.$file."\n".' }') !== false) {
                1362        require_once(_PS_MODULE_DIR_.$module.'/'.$module.'.php');
           1363         } else {
            1364            $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($file_path, strlen(_PS_ROOT_DIR_)));
              1365      }
 

please check and help me....

Link to comment
Share on other sites

That looks like tricky code.

As I understand it a few lines before it loads the main file of a module ($module.'/'.$module.'.php'). And in this eval it evaluates that line. As that produces an error it suggests that that file for one of your modules contains invalid php. 

So now the trick is to find out which module has this problem. I would start with just adding some debug code that echoes the module name just before these lines.

Link to comment
Share on other sites

22 hours ago, musicmaster said:

That looks like tricky code.

As I understand it a few lines before it loads the main file of a module ($module.'/'.$module.'.php'). And in this eval it evaluates that line. As that produces an error it suggests that that file for one of your modules contains invalid php. 

So now the trick is to find out which module has this problem. I would start with just adding some debug code that echoes the module name just before these lines.

I trying do add 2checkout payment gateway module in to prestashop and after that facing this issue. Is that module not support prestashop? And how I use that module?

Link to comment
Share on other sites

3 hours ago, keygadgetz said:

I trying do add 2checkout payment gateway module in to prestashop and after that facing this issue. Is that module not support prestashop? And how I use that module?

Did you check your PHP version versus the PHP and PS versions that your version of this module supports?

Try installing this module on a fresh Prestashop installation of the same version. It that gives the same error you might ask the supplier of the module.

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...