Jump to content

Namespaces and etc.


Algirdas

Recommended Posts

Hello,

 

I'm working with Prestashop for a while. At the moment I'm making XML import module.
I made xmlimport.php class and it works fine, but after I created new file to handle cron job tasks Prestashop started to throw me errors:

2 errors 

  1. xmlimport (parse error in /modules/xmlimport/xmlimport.php)
  2. xmlimport (class missing in /modules/xmlimport/xmlimport.php)

If I comment this:

require _PS_MODULE_DIR_.'xmlimport/vendor/autoload.php';
use Prewk\XmlStringStreamer;
use Prewk\XmlStringStreamer\Stream;
use Prewk\XmlStringStreamer\Parser;

then Prestashop don't show errors anymore.

 

One more time, if I add my module to fresh installed Prestashop everything works fine, but after I create new file (cron.php) Prestashop starts showing me that error. 

 

cron.php content:
 

<?php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/xmlimport.php');

if (substr(Tools::encrypt('crone/index'),0,10) != Tools::getValue('token') ||
    !Module::isInstalled('xmlimport'))
    die('Bad token');

echo "Testing";
Link to comment
Share on other sites

Some more details, in Model.php I added:

var_dump(eval('if (false){	'.$file.' }') !== false);

var_dump return:

Parse error: syntax error, unexpected 'private' (T_PRIVATE) in /var/www/html/prestashop/classes/module/Module.php(1243) : eval()'d code on line 1
bool(false)

At the moment xmlimport.php content:
 

<?php

class XmlImport extends Module
{
//empty class
}
?>

So where eval see "private"? Really, wtf?

Link to comment
Share on other sites

  • 1 year 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...