Jump to content

Restore old modules


matloki

Recommended Posts

Hi, I've a problem since years so I've decided is time to solve it. A lot of time ago I've updated a module, don't remember which one, then since that day I wasn't able to go again in the module page in the BO. My presta is 1.6.0.14. I think I can solve the problem re-installing all the module of the version 1.6.0.14, it is correct? In case how to do it and which suggestions do you have?

In this situation I can't even update the version of prestashop cause I'm not able to enter in the modules and I'm afraid to try to update the version manually.

Thanks a lot to everyone can help me!

Link to comment
Share on other sites

1 hour ago, matloki said:

Hi, I've a problem since years so I've decided is time to solve it. A lot of time ago I've updated a module, don't remember which one, then since that day I wasn't able to go again in the module page in the BO. My presta is 1.6.0.14. I think I can solve the problem re-installing all the module of the version 1.6.0.14, it is correct? In case how to do it and which suggestions do you have?

In this situation I can't even update the version of prestashop cause I'm not able to enter in the modules and I'm afraid to try to update the version manually.

Thanks a lot to everyone can help me!

Why can't you open modules page?

Edited by joseantgv (see edit history)
Link to comment
Share on other sites

1 minute ago, joseantgv said:

Why can't you open modules page?

From what I've seen because I've update a module of 1.7 version so I should have to delete that module and everything should work again but I don't know which module I've updated...

That's the page I receive when I click on module page:

Fatal error: Can't use function return value in write context in /web/htdocs/www.xxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.xxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code:
Can't use function return value in write context

Thanks to have a look at my tragedy :D

Link to comment
Share on other sites

1 minute ago, matloki said:

From what I've seen because I've update a module of 1.7 version so I should have to delete that module and everything should work again but I don't know which module I've updated...

That's the page I receive when I click on module page:

Fatal error: Can't use function return value in write context in /web/htdocs/www.xxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.xxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code:
Can't use function return value in write context

Thanks to have a look at my tragedy :D

And which PS version are you running?

Link to comment
Share on other sites

8 minutes ago, joseantgv said:

Please edit file `classes/module/Module.php` and just before line 1056 please set:

Then reload page and it should display a lot of lines. Copy here the content.

Little bit long... :)

string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" Fatal error: Can't use function return value in write context in /web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1058) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1058) : eval()'d code:
Can't use function return value in write context

 

Edited by matloki (see edit history)
Link to comment
Share on other sites

cannot access module page means there is 500 error.

1) enable ps debug mode and get the actual error stopping the module page from loading.

2) search for that issue and post here

the error will tell you  the module if in fact that is the issue.

tip:  when was something updated on file?  use ftp, and sort by date updated...this gives you date/time of when a module was loaded/modified.

 

Link to comment
Share on other sites

34 minutes ago, El Patron said:

cannot access module page means there is 500 error.

1) enable ps debug mode and get the actual error stopping the module page from loading.

2) search for that issue and post here

the error will tell you  the module if in fact that is the issue.

tip:  when was something updated on file?  use ftp, and sort by date updated...this gives you date/time of when a module was loaded/modified.

 

@El Patron thanks a lot you too. How can I enable the debug mode?

Link to comment
Share on other sites

37 minutes ago, El Patron said:

cannot access module page means there is 500 error.

1) enable ps debug mode and get the actual error stopping the module page from loading.

2) search for that issue and post here

the error will tell you  the module if in fact that is the issue.

tip:  when was something updated on file?  use ftp, and sort by date updated...this gives you date/time of when a module was loaded/modified.

 

Dunno if is related when I go in configuration on the list of missed/changed files there is this list:

Changed/missing files have been detected.

Missing files (2)

  • .gitignore
  • .gitmodules

Updated files (23)

  • CONTRIBUTORS.md
  • classes/Notification.php
  • classes/cache/index.php
  • classes/controller/AdminController.php
  • classes/controller/index.php
  • classes/db/index.php
  • classes/helper/index.php
  • classes/log/index.php
  • classes/module/Module.php
  • classes/module/index.php
  • classes/order/index.php
  • classes/pdf/index.php
  • classes/range/index.php
  • classes/shop/index.php
  • classes/stock/index.php
  • classes/tax/index.php
  • classes/webservice/index.php
  • config/config.inc.php
  • config/defines.inc.php
  • config/defines_uri.inc.php
  • config/smarty.config.inc.php
  • config/smartyadmin.config.inc.php
  • config/smartyfront.config.inc.php
Link to comment
Share on other sites

2 minutes ago, El Patron said:

not really related but until you follow my advice on enabling debug mode to get error it's all like above, guessing lol

I would like but you've to talk with me like a baby :D Could you please tell me how can I enable the debug mode?

Link to comment
Share on other sites

Thanks, wanna grow fast cause I've already spent many time as baby :D

I've done these steps:

File manager - prestashop - config - defines.ini.php - changed PS_mode_dev from false to true - save

Upload the file in ftp - Bo - Modules

But that's the message:

Fatal error: Can't use function return value in write context in /web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code:
Can't use function return value in write context

I think I've made a mistake somewhere...

Link to comment
Share on other sites

15 hours ago, El Patron said:

ok...let's raise the baby!

go to google and type in 'prestashop how to enable debug'

for you to manage a PS this is first thing you need to learn.  And we go from there.  I have 4 grown children and 12 grandchildren so raising babies I got. lol

Tried again this morning but same result... May I ask why Jose told me to do here above? What can we understand with all those lines?

But above all, there will be a solution to my problem? Thanks!

Link to comment
Share on other sites

Hmmm, I was trying to see which files have been modified via filezilla. I see a lot of folders dtd 2015, instead all the folders in modules are updated to yesterday. Once I enter into the folder: bankwire (is the first one), I see the files updated to 2016, carriercompare files are updated to 2017 (permission 0644), blockadvertising updated at 2015... So in this way I should be able to see which modules are the most recent ones? If yes, how to restore the module to the original one? For example, carriercompare is at the moment the most recent one, how can re-install the original carriercompare version 1.6.0.14?

Link to comment
Share on other sites

On 12/22/2018 at 4:29 PM, matloki said:

Little bit long... :)

string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" string(479) "#0 /web/htdocs/www.ordomcm.com/home/prestashop/controllers/admin/AdminModulesController.php(1394): ModuleCore::getModulesOnDisk(true, false, 1) #1 /web/htdocs/www.ordomcm.com/home/prestashop/classes/controller/Controller.php(180): AdminModulesControllerCore->initContent() #2 /web/htdocs/www.ordomcm.com/home/prestashop/classes/Dispatcher.php(373): ControllerCore->run() #3 /web/htdocs/www.ordomcm.com/home/prestashop/admin1467/index.php(54): DispatcherCore->dispatch() #4 {main}" Fatal error: Can't use function return value in write context in /web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1058) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.ordomcm.com/home/prestashop/classes/module/Module.php(1058) : eval()'d code:
Can't use function return value in write context

 

Not the result I expected. Please copy here the code you have at `classes/module/Module.php` around line 1056

Link to comment
Share on other sites

5 hours ago, joseantgv said:

Not the result I expected. Please copy here the code you have at `classes/module/Module.php` around line 1056

Thanks a lot again. From 1041 to 1060, bold the line 1056:

    // If use config flag is at false or config.xml does not exist OR need instance OR need a new config.xml file
            if (!$useConfig || !$xml_exist || (isset($xml_module->need_instance) && (int)$xml_module->need_instance == 1) || $needNewConfigFile)
            {
                // If class does not exists, we include the file
                if (!class_exists($module, false))
                {
                    // Get content from php file
                    $filepath = _PS_MODULE_DIR_.$module.'/'.$module.'.php';
                    $file = trim(file_get_contents(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
                    if (substr($file, 0, 5) == '<?php')
                        $file = substr($file, 5);
                    if (substr($file, -2) == '?>')
                        $file = substr($file, 0, -2);
                    // If (false) is a trick to not load the class with "eval".
                    // This way require_once will works correctly
                    if (eval('if (false){    '.$file.' }') !== false)
                        require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
                    else
                        $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
                }

Link to comment
Share on other sites

On 12/25/2018 at 8:36 AM, matloki said:

Thanks a lot again. From 1041 to 1060, bold the line 1056:

    // If use config flag is at false or config.xml does not exist OR need instance OR need a new config.xml file
            if (!$useConfig || !$xml_exist || (isset($xml_module->need_instance) && (int)$xml_module->need_instance == 1) || $needNewConfigFile)
            {
                // If class does not exists, we include the file
                if (!class_exists($module, false))
                {
                    // Get content from php file
                    $filepath = _PS_MODULE_DIR_.$module.'/'.$module.'.php';
                    $file = trim(file_get_contents(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
                    if (substr($file, 0, 5) == '<?php')
                        $file = substr($file, 5);
                    if (substr($file, -2) == '?>')
                        $file = substr($file, 0, -2);
                    // If (false) is a trick to not load the class with "eval".
                    // This way require_once will works correctly
                    if (eval('if (false){    '.$file.' }') !== false)
                        require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
                    else
                        $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
                }

Please try:

var_dump($module);
if (eval('if (false){    '.$file.' }') !== false)
    require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
else {
    $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
}

 

Link to comment
Share on other sites

3 hours ago, joseantgv said:

Please try:


var_dump($module);
if (eval('if (false){    '.$file.' }') !== false)
    require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
else {
    $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
}

 

Replaced:

if (eval('if (false){    '.$file.' }') !== false)
                        require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
                    else
                        $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
                }

With:

var_dump($module);
if (eval('if (false){    '.$file.' }') !== false)
    require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
else {
    $errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
}

Hope I've replaced the correct lines. The result is:

Parse error: syntax error, unexpected T_PUBLIC in /web/htdocs/www.xxxx.com/home/prestashop/classes/module/Module.php on line 1255

Then I had trouble when I copied/pasted the replaced on line 1060 "}", this was the message: 

Parse error: syntax error, unexpected '}' in /web/htdocs/www.xxxxx.com/home/prestashop/classes/module/Module.php on line 1060

so I've upload an older module.php now everything is ok excluding the same error when I try to load modules in the BO:

Fatal error: Can't use function return value in write context in /web/htdocs/www.xxxxxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code on line 95 [PrestaShop] Fatal error in module file :/web/htdocs/www.xxxxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code:
Can't use function return value in write context

The code line 95 is: protected static $modules_cache;

I receive this error also when I go to "prices rules" - "marketing" and the same following error when I try to "add a new carrier" into the "shipping" - "carrier" = Fatal error: Can't use function return value in write context in /web/htdocs/www.xxxxxx.com/home/prestashop/classes/module/Module.php(1056) : eval()'d code on line 95

I'd like to understand better prerstashop but my problem seems not so easy. Thanks once again for your help!

 

Edited by matloki (see edit history)
Link to comment
Share on other sites

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...