htrow Posted November 4, 2016 Share Posted November 4, 2016 (edited) hi every one, I need help to solv a problem. here it goes, 1. I installed 1.6.1.7 version prestashop. 2. when i configure the shop in backoffice, I disabled a standard module which shows a block extra information on frontpage in "Module and services" , see attached files. 3. now the backoffice showing , [PrestaShop] Fatal error in module file :/var/www/vhosts/my root catalog /modules/statsdata/statsdata.php: syntax error, unexpected '[' and i am not able to access "modules and services" also frontpage showing "page isn’t working" can you give me some advices? Edited November 4, 2016 by htrow (see edit history) Link to comment Share on other sites More sharing options...
razaro Posted November 4, 2016 Share Posted November 4, 2016 Hi Can you go to Advanced Parameters > Configuration Information and check for issues, especially PHP version ? Link to comment Share on other sites More sharing options...
polxxx Posted November 4, 2016 Share Posted November 4, 2016 The same error for me, when I try to update a module: [PrestaShop] Fatal error in module file :/var/www/vhosts/xxxxxxx/httpdocs/modules/statsdata/statsdata.php: syntax error, unexpected '[' My info Informazioni sul server Linux #1 SMP Thu Aug 11 09:41:14 MSK 2016 x86_64 Versione software server Apache Versione di PHP 5.3.29 Limite memoria 128M Tempo di esecuzione massimo 120 Link to comment Share on other sites More sharing options...
piribipipi Posted November 4, 2016 Share Posted November 4, 2016 Hi, i believe that the problem is the new code added in the /modules/statsdata/statsdata.php file. If you go to line 101: private function getScriptPlugins($params) { if (!isset($params['cookie']->id_guest)) { Guest::setNewGuest($params['cookie']); if (Configuration::get('PS_STATSDATA_PLUGINS')) { if (_PS_VERSION_ >= 1.7) { $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]); } else { $this->context->controller->addJS($this->_path.'js/plugindetect.js'); } .............. If u are not using PS 1.7, u can comment the line /* $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]); */ and will work! If u are using PS 1.7... you will need to check that line and modify it.. There is a little problem with syntax on that line that need to be solved. 3 Link to comment Share on other sites More sharing options...
polxxx Posted November 5, 2016 Share Posted November 5, 2016 Hi, i believe that the problem is the new code added in the /modules/statsdata/statsdata.php file. If you go to line 101: private function getScriptPlugins($params) { if (!isset($params['cookie']->id_guest)) { Guest::setNewGuest($params['cookie']); if (Configuration::get('PS_STATSDATA_PLUGINS')) { if (_PS_VERSION_ >= 1.7) { $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]); } else { $this->context->controller->addJS($this->_path.'js/plugindetect.js'); } .............. If u are not using PS 1.7, u can comment the line /* $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]); */ and will work! If u are using PS 1.7... you will need to check that line and modify it.. There is a little problem with syntax on that line that need to be solved. Great piribipipi! 1.6.7, line commented and it works. Thx a lot. 1 Link to comment Share on other sites More sharing options...
razaro Posted November 5, 2016 Share Posted November 5, 2016 (edited) True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); Edited November 5, 2016 by razaro (see edit history) 4 Link to comment Share on other sites More sharing options...
gibsorter Posted November 5, 2016 Share Posted November 5, 2016 True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); @razaro: You're a lifesaver! I just added the 2nd closing bracket @ EOL and it works like a charm. 1 Link to comment Share on other sites More sharing options...
razaro Posted November 5, 2016 Share Posted November 5, 2016 Thanks gibsorter, missed that but now it is fixed. Link to comment Share on other sites More sharing options...
htrow Posted November 6, 2016 Author Share Posted November 6, 2016 great thanks , it works. Link to comment Share on other sites More sharing options...
sexysecret Posted November 6, 2016 Share Posted November 6, 2016 True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); TY SO MUCH!!! btw, Can someone tell me how to upgrade my PHP version? i use the 5.3.27 version and now I have to change to version 5.4 but when I upgrade from cpanel gives me another "fatal error" I appreciate the help Link to comment Share on other sites More sharing options...
leoaga Posted November 7, 2016 Share Posted November 7, 2016 GREAT, Its works perfectly! Thank you Link to comment Share on other sites More sharing options...
razaro Posted November 7, 2016 Share Posted November 7, 2016 @sexysecret Do open new topic with more details about that fatal error and your server information as well as PrestaShop version. Link to comment Share on other sites More sharing options...
PeteW Posted November 7, 2016 Share Posted November 7, 2016 True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); Thanks - it works, but am I going blind? Where's the opening bracket for that closing bracket? 1 Link to comment Share on other sites More sharing options...
razaro Posted November 7, 2016 Share Posted November 7, 2016 Maybe like this $this->context->controller->registerJavascript( 'modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150) ); Link to comment Share on other sites More sharing options...
DiegoMarquina Posted November 7, 2016 Share Posted November 7, 2016 (edited) Hello Everybody, thank you in advanced. I AM GOING CRAZY HERE!!! I was adding products to my new store, and suddenly it stopped working. In my store front I get this message: page isn´t working. drakoslab.com is currently unable to handle this request. 500 in my backoffice, I cant access the modules & Services, and it shows this message: [PrestaShop] Fatal error in module file :/home/drakos/public_html/tienda/modules/statsdata/statsdata.php:syntax error, unexpected '[' As far I can tell, I can access all other areas of my backoffice. How do I fix this?? How do I get to where I need to edit line 101? how do I update my PHP version? (i´m using PS version 1.6.1.7) I´m a Newby, and not much of a computer person, please help me as if you were teaching a kid. thank you!!! Edited November 7, 2016 by DiegoMarquina (see edit history) Link to comment Share on other sites More sharing options...
@my-dressing.eu Posted November 7, 2016 Share Posted November 7, 2016 Hi Can you go to Advanced Parameters > Configuration Information and check for issues, especially PHP version ? HELLO Link to comment Share on other sites More sharing options...
DiegoMarquina Posted November 7, 2016 Share Posted November 7, 2016 Yes, in the CHECK YOUR CONFIGURATION Box. it reads: REQUIRED PARAMETERS: OK OPTIONAL PARAMETERS: PLEASE FIX THE FOLLOWING ERROR(S) -YOU ARE USING PHP 5.3.29 VERSION. SONN, THE LATEST PHP VERSION SUPPORTED BY PRESTASHOP WILL BE PHP 5.4 TO MAKE SURE YOU´RE READY FOR THE FUTURE, WE RECOMMEND YOU TO UBREADE TO PHP 5.4 NOW! -ALLOW THE PHP FOPEN()FUNCTION ON YOUR SERVER. I do not know what they are talking about thank you for your help. Link to comment Share on other sites More sharing options...
DiegoMarquina Posted November 8, 2016 Share Posted November 8, 2016 thank you, I just updated de PHP version to 5.5. the store front changed the error message for: Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Link to comment Share on other sites More sharing options...
PeteW Posted November 8, 2016 Share Posted November 8, 2016 (edited) Maybe like this $this->context->controller->registerJavascript( 'modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150) ); Duh! Thanks - evidently I *am* going blind. Not so much simply "adding a closing bracket" as "changing the array format," though - which makes sense. Edited November 8, 2016 by PeteW (see edit history) Link to comment Share on other sites More sharing options...
mbraczek Posted November 11, 2016 Share Posted November 11, 2016 @razaro: You're a lifesaver! I just added the 2nd closing bracket @ EOL and it works like a charm. great, you safe my life :-) it works Link to comment Share on other sites More sharing options...
Peeters Posted November 11, 2016 Share Posted November 11, 2016 @all: you saved my day! Link to comment Share on other sites More sharing options...
Alex_sofibellaeu Posted November 11, 2016 Share Posted November 11, 2016 Thank you very muchYou saved me from a disaster Link to comment Share on other sites More sharing options...
kennys1974 Posted November 15, 2016 Share Posted November 15, 2016 hi every one, I need help to solv a problem. here it goes, 1. I installed 1.6.1.7 version prestashop. 2. when i configure the shop in backoffice, I disabled a standard module which shows a block extra information on frontpage in "Module and services" , see attached files. 3. now the backoffice showing , [PrestaShop] Fatal error in module file :/var/www/vhosts/my root catalog /modules/statsdata/statsdata.php: syntax error, unexpected '[' and i am not able to access "modules and services" also frontpage showing "page isn’t working" can you give me some advices? Don't comment the line. Replace opening '[' with array. So full line will read....."$this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150));" Link to comment Share on other sites More sharing options...
MDEMARCHI Posted November 15, 2016 Share Posted November 15, 2016 True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); Perfect!!!! Link to comment Share on other sites More sharing options...
rlwelch4646 Posted November 16, 2016 Share Posted November 16, 2016 I'm having a different issue with my module/statsdata/statsdata.php file, this time at line 108. The error I'm getting is: Parse error: syntax error, unexpected '[' on line 108. Any help would be appreciated! // Record the guest path then increment the visit counter of the page $token_array = Connection::setPageConnection($params['cookie']); ConnectionsSource::logHttpReferer(); if (Configuration::get('PS_STATSDATA_PAGESVIEWS')) Page::setPageViewed($token_array['id_page']); if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) { // Ajax request sending the time spend on the page $token = sha1($token_array['id_connections'].$token_array['id_page'].$token_array['time_start']._COOKIE_KEY_); $html .= ' <script type="text/javascript"> var time_start; $(window).load( function() { time_start = new Date(); } ); $(window).unload( function() { var time_end = new Date(); var pagetime = new Object; pagetime.type = "pagetime"; pagetime.id_connections = "'.(int)$token_array['id_connections'].'"; pagetime.id_page = "'.(int)$token_array['id_page'].'"; pagetime.time_start = "'.$token_array['time_start'].'"; pagetime.token = "'.$token.'"; pagetime.time = time_end-time_start; } ); </script>'; } Link to comment Share on other sites More sharing options...
gigiscol Posted November 16, 2016 Share Posted November 16, 2016 True if you do not use 1.7 commenting line will get job done. But to explain, issue is in PHP version 5.3. It is bit older so it shows error on that line. To make it work and not commenting try using this code instead. $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150)); Thanks - it works, but am I going blind? Where's the opening bracket for that closing bracket? Excellent ... thanks !!! Link to comment Share on other sites More sharing options...
brmadrid Posted November 18, 2016 Share Posted November 18, 2016 Hi! I´m using Prestashop 1.7, when i try to enter in the "menú" module to configure the show categories, appear this error: [PrestaShop] Fatal error in module file :/var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/app/bootstrap.php.cache: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Catchable Fatal Error: Argument 2 passed to PrestaShopBundle\Translation\TranslatorComponent::trans() must be of the type array, integer given, called in /var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/config/smartyadmin.config.inc.php on line 114 and defined' in /var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php:35 Stack trace: #0 /var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/src/PrestaShopBundle/Translation/PrestaShopTranslatorTrait.php(35): Symfony\Component\Debug\ErrorHandler->handleError(4096, 'Argument 2 pass...', '/var/www/vhosts...', 35, Array) #1 /var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/config/smartyadmin.config.inc.php(114): PrestaShopBundle\Translation\TranslatorComponent->trans('There are %d wa...', 2, NULL) #2 /var/www/vhosts/26/190975/webspace/httpdocs/MYDOMAIN.com/app/cache/prod/smarty/compile/8c/85/6b Link to comment Share on other sites More sharing options...
razaro Posted November 18, 2016 Share Posted November 18, 2016 @brmadrid Please do create new topic about your issue. Link to comment Share on other sites More sharing options...
mcoraz Posted November 20, 2016 Share Posted November 20, 2016 Thank you! worked great!! Link to comment Share on other sites More sharing options...
bartom34 Posted November 21, 2016 Share Posted November 21, 2016 Awesome, the fix works perfectly! Link to comment Share on other sites More sharing options...
Pshopmod Posted November 23, 2016 Share Posted November 23, 2016 @razaro: Thank you! Link to comment Share on other sites More sharing options...
startfoto Posted November 25, 2016 Share Posted November 25, 2016 hello, I updated and it gives me a way modules / date stats / statsdata.php) when access modules and services, please help urgently. Link to comment Share on other sites More sharing options...
ArtistToonz Posted December 10, 2016 Share Posted December 10, 2016 (edited) Maybe like this $this->context->controller->registerJavascript( 'modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', array('position' => 'bottom', 'priority' => 150) ); @razaro - Greetings! Where does one put this code in the statsdata.php document? Which line? Thanks! Edited December 10, 2016 by ArtistToonz (see edit history) Link to comment Share on other sites More sharing options...
razaro Posted December 10, 2016 Share Posted December 10, 2016 Check https://github.com/PrestaShop/statsdata/blob/master/statsdata.php#L108 they fixed it some time ago https://github.com/PrestaShop/statsdata/commit/3c919faa3f52384304594d850600119f7ead5859 Link to comment Share on other sites More sharing options...
ArtistToonz Posted December 10, 2016 Share Posted December 10, 2016 @razaro - Thanks for the info. Side note: The problem began yesterday when I updated the module yesterday via my shop. Link to comment Share on other sites More sharing options...
kvshijo Posted December 16, 2016 Share Posted December 16, 2016 working !!!!! enabled PHP 5.6 (single php.ini) PHP 5.6 (Single php.ini) from CPANEL > PHP Configuration > Link to comment Share on other sites More sharing options...
anaderol Posted February 26, 2017 Share Posted February 26, 2017 Hi, I have a similar error Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.miosito.it/home/modules/statsdata/statsdata.php on line 234 Informazioni sul server Linux #1 SMP Fri Nov 18 19:25:05 UTC 2016 x86_64 Versione software server Apache Versione di PHP 5.3.29 Limite memoria 128M Tempo di esecuzione massimo 120 Versione di PrestaShop 1.6.0.9 I 'm not an expert, you can help me to resolve the problem and to tell me where I must intervene? Thanks in advance Link to comment Share on other sites More sharing options...
nberga Posted September 1, 2017 Share Posted September 1, 2017 Hi, I'm getting the same error [PrestaShop] Fatal error in module file /modules/cloudswipe/lib/CloudSwipe/Http.php:syntax error, unexpected '[' Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now