Jump to content
www.remoteshaman.com

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

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 3
  • Thanks 2

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

I would stick with PHP 7.0.13 (or the latest of the 7.0) branch for now.

 

There are likely other changes required to fully support PHP 7.1.  Ideally you should create forge tickets for those issues, or contribute to Prestashops github as you find and fix issues

Share this post


Link to post
Share on other sites

i upgrade my server to php 7.0.18 and mysql 5.7 

it's much faster than before,it's will take about 1700ms to load the product page,

now only 500ms

Share this post


Link to post
Share on other sites
Am 17.12.2016 um 5:37 AM schrieb duredo.com:

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

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

Share this post


Link to post
Share on other sites

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? 

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

PS v1.6.1.10 does not support PHP 7.1

Your options?

  1. Upgrade to the latest version of PS v1.6
  2. Downgrade your PHP version to PHP 5.6 or possibly 7.0
  3. Apply patches to Prestashop to support PHP 7.1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi.

I have now upgraded my site to 1.6.1.23 but it dos not work with php 7.1

Backoffice work but frontoffice dos not.

I attache a picture.

Regards

hemsida.jpg

Share this post


Link to post
Share on other sites

perhaps you have a custom theme or module that does not support it.  enabled debug mode and see if that provides a helpful error

Share this post


Link to post
Share on other sites

also in Product.php

line 5151

$sql_values = '';

has to be changed to 

$sql_values = array();

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More