Jump to content

Fatal 500 Error after upgrading Faceted search module


Symphony

Recommended Posts

Using PS 1.7.4.3

I went to configure the Faceted Search module and there was an upgrade option. 

I clicked this and it froze.

Thereafter I could not get into the modules & services section of the backoffice - it delivered a Server 500 error.

In dev mode it gave the following error.

 

The main website also stopped functioning:

 

Symfony\Component\Debug\Exception\ FatalErrorException

  1.      *
  2.      * @var array
  3.      */
  4.     const ISO_CODE_TAX_FREE = [
  5.         'US',
  6.     ];
  7.     /**
  8.      * @var bool
  9.      */
  10.     private $ajax;

FatalErrorException

Symfony\Component\Debug\Exception\FatalErrorException:
Compile Error: Arrays are not allowed in class constants

  at modules/ps_facetedsearch/ps_facetedsearch.php:62

 

Level Channel Message
INFO 17:20:31 request Matched route "admin_module_manage".
DEBUG 17:20:31 security Read existing security token from the session.
DEBUG 17:20:31 security User was reloaded from a user provider.
DEBUG 17:20:31 doctrine SELECT name FROM psik_module WHERE active = 1
DEBUG 17:20:32 doctrine SELECT p0_.id AS id_0, p0_.id_employee AS id_employee_1, p0_.id_module AS id_module_2, p0_.date_add AS date_add_3, p0_.date_upd AS date_upd_4 FROM psik_module_history p0_ WHERE p0_.id_employee = ?
CRITICAL 17:20:33 php Fatal Compile Error: Arrays are not allowed in class constants
INFO 17:20:33 php User Deprecated: Implementing "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "Csa\Bundle\GuzzleBundle\DataCollector\GuzzleCollector".
CRITICAL 17:20:33 request

Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Compile Error: Arrays are not allowed in class constants" at /home/symphony/public_html/modules/ps_facetedsearch/ps_facetedsearch.php line 62

 

 

 

Link to comment
Share on other sites

2 hours ago, Janett said:

What is your PHP version ? It seems you use an obsolete version, Prestashop 1.7.4 can be used with PHP 5.6 minimum and PHP 7.1 maximum.

See https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/

Thanks Janett,

I have checked our hosting server and the Php webserver version is 7.2.7.

MySQL is 5.6.43

I have restored a backup and all is working fine on the server versions above. It was just upgrading the Faceted Search module that screwed it up.

Why does an earlier version of PS work fine on 7.2.7, but the upgraded module doesn't?

Link to comment
Share on other sites

Strange this error is append with PHP version doesn’t not support this syntax. Array can be used in Const since PHP 5.6 and Array can be used in Define since PHP 7. (You can read PHP documentation)

Are you sure your PHP version is the same in all folders on your server ? Sometime people use PHP 7 on admin folder and PHP 5 in others. This can be configured in htaccess for example.

Check on Prestashop back office -> Advanced Parameters -> Informations. You can read PHP version running with Prestashop.

Ask your hosting provider tell him your error and link to PHP documentation https://www.tutorialspoint.com/php7/php7_constant_arrays.htm

About your current PHP version and current PrestaShop version : you should not use PHP 7.2 with Prestashop 1.7.4, we know about issue with it. You can use PHP 7.1 max https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/

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

  • 2 weeks later...

Many thanks for your reply. Sorry it's taken a while. in the meantime I reverted my installation from a backup so my website is functional, but I obviously don't want to upgrade the Faceted Search module again as it will bring the error back, and the website down.

I have checked on the PS installation (backoffice/advanced/information) and it says that the PHP version that our installation is using is 5.5.38.

Do we then need to get our hosting provider to change anything? If I go into our hosting control panel, there is a PHP MyAdmin and it says that the Webserver is using 7.2.7. Sorry if I sound a bit dense.

Regards,

Dave

Link to comment
Share on other sites

I have spoken to our hosting provider, and they have pointed me to the PHP Manager on the cPanel.

According to this, we are running on 5.5

Does this then answer the question (on the basis that you said the functions require at least 5.6). Furthermore, should I set it to use 7.1 to make sure it is as fully compatible as possible?

Many thanks,

Dave

 

Link to comment
Share on other sites

Further update:

I changed the domains to PHP 7.1 and the website stopped functioning: it delivered a 500 error; I have reverted back to 5.5

Is there something I need to do in PS if I change the PHP version?

As it stands I have a functioning website on PHP 5.5; if I upgrade the Faceted Search module I will expect the website to fail due to the PHP version being too low, but if I upgrade the PHP version on the domains then the website also fails.

 

Link to comment
Share on other sites

It seems you use an obsolete version, Prestashop 1.7.4 can be used with PHP 5.6 minimum and PHP 7.1 maximum : https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/

So you have to change PHP version to PHP 5.6 minimum on cPanel.

Warning : PHP 5.6 support will be dropped in Prestashop 1.7.7 : http://build.prestashop.com/news/announcing-end-of-support-for-obsolete-php-versions/

You have to enable Maintenance Mode on Prestashop : Preferences > Maintenance

Clear cache on Advanced Parameters > Performances

Change PHP Version to PHP 5.6 or PHP 7 < 7.2

Clear cache manualy with FTP by remove all folders and files in /var/cache/ Prestashop will regerate them.

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

4 minutes ago, Janett said:

You have to enable Maintenance Mode on Prestashop : Preferences > Maintenance

Clear cache on Advanced Parameters > Performances

Change PHP Version to PHP 5.6 or PHP 7 < 7.2

Clear cache manualy with FTP by remove all folders and files in /var/cache/ Prestashop will regerate them.

Go to Prestashop BO disable Maintenance Mode

Test your website

Sorry I have edited in same time 😇

Link to comment
Share on other sites

Thanks Janett,

I followed those steps but I still got the 500 error; this was at the point of trying to log back into to the BO to disable Maintenance Mode. I therefore had to revert to PHP 5.5 again just to get access and everything working.

The same applies - if I change to 7.1 I get 500 errors. What is really strange is that I'm in debug mode but the browser no longer gives me the error details; it did originally say something about lack of memory allocated, but I can't get the message to come up any more since performing the above steps; all I get is a white screen 500 error.

I have tried 5.6 and the site seems to work (it was very sluggish, but I assume that may be because the cache needed to be rebuilt).

Will 5.6 suffice for what i need?

Link to comment
Share on other sites

It is running on 5.6 and all seems OK. I have had a few other attemopts at going to 7.0 or 7.1 but same problems as before.

Assuming 5.6 would be fine for the Faceted Search Module, I again attempted updating.

Just like last time, I clicked update and the circle just went round and round - it never seemed to complete the update - just l;ike last time.

When I went back into the website everything but the homepage against was broken.

In the meantime I have restored a backup and we are working again, but it seems there is no way to update this module without errors.

The error is as follows:-

 

[PrestaShopDatabaseException]

Table 'symphony_pres466.psik_layered_filter_block' doesn't exist

SELECT data FROM psik_layered_filter_block WHERE hash="4ab4bf57a9bc13dc1c0b09e9ec35a75c" LIMIT 1


at line 746 in file classes/db/Db.php

741.         if ($webservice_call && $errno) {

742.             $dbg = debug_backtrace();

743.             WebserviceRequest::getInstance()->setError(500, '

 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);

744.         } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {

745.             if ($sql) {

746.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');

747.             }

748.

749.             throw new PrestaShopDatabaseException($this->getMsgError());

750.         }

751.     }

  • DbCore->displayError - [line 378 - classes/db/Db.php] - [1 Arguments]

  • DbCore->query - [line 645 - classes/db/Db.php] - [1 Arguments]

  • DbCore->getRow - [line 159 - modules/ps_facetedsearch/src/Filters/Block.php] - [1 Arguments]

  • PrestaShop\Module\FacetedSearch\Filters\Block->getFromCache - [line 172 - modules/ps_facetedsearch/src/Product/SearchProvider.php] - [1 Arguments]

  • PrestaShop\Module\FacetedSearch\Product\SearchProvider->runQuery - [line 316 - classes/controller/ProductListingFrontController.php] - [2 Arguments]

  • ProductListingFrontControllerCore->getProductSearchVariables - [line 531 - classes/controller/ProductListingFrontController.php]

  • ProductListingFrontControllerCore->doProductSearch - [line 124 - controllers/front/listing/CategoryController.php] - [2 Arguments]

  • CategoryControllerCore->initContent - [line 255 - classes/controller/Controller.php]

  • ControllerCore->run - [line 428 - classes/Dispatcher.php]

  • DispatcherCore->dispatch - [line 28 - index.php]

 

 

 

 

 

 

 

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