Jump to content

PS 1.6.x and 1.7.x on PHP 7.1 Fatal error: operator not supported in DbQuery.php


itmag.pro

Recommended Posts

 If use PHP 7.1 for PrestaShop 1.6.x only (in 1.7.x this fixed) we have get this fatal error:

[16-Dec-2016 01:15:47 Europe/Kiev] PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/classes/db/DbQuery.php:96

need change:

protected $query = array(
    'type'   => 'SELECT',
    'select' => array(),
    'from'   => '',
    'join'   => array(),
    'where'  => array(),
    'group'  => array(),
    'having' => array(),
    'order'  => array(),
    'limit'  => array('offset' => 0, 'limit' => 0),
);

to

protected $query = array(
    'type'   => 'SELECT',
    'select' => array(),
    'from'   => array(),
    'join'   => array(),
    'where'  => array(),
    'group'  => array(),
    'having' => array(),
    'order'  => array(),
    'limit'  => array('offset' => 0, 'limit' => 0),
);
Edited by www.remoteshaman.com (see edit history)
  • Like 5
  • Thanks 3
Link to comment
Share on other sites

PrestaShop has not been made compatible with PHP 7.1. You will come across this problem even more.

 

PHP 7 provide best performance than PHP 5. PrestaShop must be adopt for/under PHP 7!!!

 

After fix DbQuery.php my PrestaShop 1.6.1.10 (backend and frontend) worked fine on PHP 7.1 - no php errors in php-errors.log no server errors and other errors I not find.

Edited by www.remoteshaman.com (see edit history)
Link to comment
Share on other sites

PHP 7 provide best performance than PHP 5. PrestaShop must be adopt for/under PHP 7!!!

 

After fix DbQuery.php my PrestaShop 1.6.1.10 (backend and frontend) worked fine on PHP 7.1 - no php errors in php-errors.log no server errors and other errors I not find.

hi, can you attach your DbQuery.php here? I need to try it
Link to comment
Share on other sites

 

 If use PHP 7.1 for PrestaShop 1.6.x only (in 1.7.x this fixed) we have get this fatal error:

[16-Dec-2016 01:15:47 Europe/Kiev] PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/classes/db/DbQuery.php:96

need change:

protected $query = array(
    'type'   => 'SELECT',
    'select' => array(),
    'from'   => '',
    'join'   => array(),
    'where'  => array(),
    'group'  => array(),
    'having' => array(),
    'order'  => array(),
    'limit'  => array('offset' => 0, 'limit' => 0),
);

to

protected $query = array(
    'type'   => 'SELECT',
    'select' => array(),
    'from'   => array(),
    'join'   => array(),
    'where'  => array(),
    'group'  => array(),
    'having' => array(),
    'order'  => array(),
    'limit'  => array('offset' => 0, 'limit' => 0),
);

Your solution worked for me as well.  Did not have this problem with php 7.0.7 though

 

Thanks anyway

  • Like 1
Link to comment
Share on other sites

great, my live site running PHP 7.1 now, will update if there is any errors

 

=== Update ===

I found error, there is no content on my dashboard statistics

Edited by duredo.com (see edit history)
Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...
  • 2 months later...
9 minutes ago, plutten22 said:

Hi.

There is no content on my dashboard statistics when i change to PHP 7.1

Did you or anyone else find any solution for the Dashboard? 

What is your exact version of Prestashop?  Perhaps you should not use PHP 7.1, and should revert to a supported PHP version

Link to comment
Share on other sites

Ok i understand.

I have made a lot of chages to the prestashop standard theme so i dont want to upgrade bc the changes will be lost.

I can not downgrade to PHP 5.6 bc my supplyer will not have it after 27 december.

How can i apply patches to Prestashop to support PHP 7.1

Regards

Link to comment
Share on other sites

That might depend on your skill level with coding.  Generally I go through the release notes and change logs for Prestashop, identify the individual changes that were made so that PS v1.6 would support PHP 7.1, and then manually apply those changes to your core files. 

If you are not a proficient coder, then you might need to look into hiring a developer

Link to comment
Share on other sites

5.6 loses support from PHP this month.  PHP 7.0 does as well

so really you should be looking to properly maintain your store and keep it up to date

being afraid to upgrade because of customizations you made is unfortunately not a good answer.  And will instead leave you open to security issues

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 3 months later...
  • 1 month later...

Hello,

I needed a help, I have a problem with the site where overnight the images of the site were all in error. We talked to the person who handled the accommodation and made the change to php because there had been an error and would have to change the php but then I got the images "no images".

If I enter BackOffice in a product the images are there, but on the site they do not appear.

How can I solve this situation?

Prestashop version 1.6.1.7

PHP version: 7.1.32

https://www.winespiritus.com/

Through the link you can see the images of products that are not giving

I look forward to a brief reply.

Best regards,

André Correia!

1.JPG

2.JPG

3.JPG

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