Jump to content

[SOLVED] Debug mode failing to activate PrestaShop


mathdex
 Share

Recommended Posts

Hello everyone, 

I'm very new to PrestaShop and I can't seem to activate debug mode (I'm running version 1.7.5).

I run PrestaShop locally on xampp.

I've tried this already:

  • Turn on "Debug mode" in the back office under "Performances"
  • Changing the '_PS_MODE_DEV_' putting it to true manually in the defines.inc.php file
  • Running an older version of php (currently on 7.3.1) in xampp
  • ...

Once debug mode is enabled, I always get this error: 

ContextErrorException

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

 

I'm sorry if this is an obvious mistake but I just can't find what I'm doing wrong.

Thanks in advance for your responses !

 

Capture.PNG

Capture2.PNG

Edited by mathdex (see edit history)

Share this post


Link to post
Share on other sites

  • 1 year later...

Just read the error and change it as suggested by the error message. For example I changed return; to return 2; in 2 places of file UnitOfWork.php (this class is used in ORM of Doctrine). Issue resolved.

Best Regards 

Maneesh Tiwari

Share this post


Link to post
Share on other sites

  • 1 month later...
On 2/26/2020 at 3:08 PM, Maneesh said:

Just read the error and change it as suggested by the error message. For example I changed return; to return 2; in 2 places of file UnitOfWork.php (this class is used in ORM of Doctrine). Issue resolved.

Best Regards 

Maneesh Tiwari

Thanks Maneesh its worked for me

Share this post


Link to post
Share on other sites

  • 3 weeks later...
On 2/26/2020 at 10:08 AM, Maneesh said:

Just read the error and change it as suggested by the error message. For example I changed return; to return 2; in 2 places of file UnitOfWork.php (this class is used in ORM of Doctrine). Issue resolved.

Best Regards 

Maneesh Tiwari

No, you should NEVER modify core files @Maneesh.

Using ‘continue 2’ is very different than using ‘continue’. If it was coded using continue, it should be left as continue until the developer decides what it should actually be changed to – it could be ‘break’ or it could be ‘continue 2’. If you get the wrong one, the logic will change and the site could break in unexpected ways.

 

See here: https://github.com/PrestaShop/PrestaShop/issues/14893

PrestaShop 1.7.0 to 1.7.3 is compatible with PHP 7.1 and PrestaShop 1.7.4 & 1.7.5 & 1.7.6 are compatible with PHP 7.2.

Next Major release PS1.7.7 will be compatible with PHP7.3

Share this post


Link to post
Share on other sites

Hi,

I had the same problem on the hosting of my Service Provider.

I had Prestashop 1.7.6.1 and PHP 7.3.

I have solved downgrading PHP to the version 7.2, I did it from the Control Panel of the Service Provider.

I don't know who canged the version of PHP on the hosting, I think the Service Provider.

cld

Share this post


Link to post
Share on other sites

  • 2 weeks later...
On 20/04/2020 at 11:12, ilclaudio said:

Salut,

J'ai eu le même problème sur l'hébergement de mon fournisseur de services.

J'avais Prestashop 1.7.6.1 et PHP 7.3.

J'ai résolu de rétrograder PHP vers la version 7.2, je l'ai fait à partir du panneau de configuration du fournisseur de services.

Je ne sais pas qui a falsifié la version de PHP sur l'hébergement, je pense que le fournisseur de services.

cld

Alors moi j'ai un souci lorsque je passe en 7.3 j'ai effectivmeent ce message d'erreur, mais quand je revien en version 7.2 si je ne suis pas en mode debug alors uniquement mon back office affiche une page blanche .... et lorsque j'active le debug le BO reviens par contre pb je ne peu pas installer de plugin ... lol je deviens fous avec ce pb

Share this post


Link to post
Share on other sites

  • 2 years later...

I am on PS 1.7.6.5 + PHP 7.3 = get a similar error too. on my server no (easy) way to install 7.2, so ->

Solution: to add two "2" in lines 2636 & 2665 of .../vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php

// use the entity association
                    if (isset($data[$field]) && is_object($data[$field]) && isset($this->entityStates[spl_object_hash($data[$field])])) {
                        $class->reflFields[$field]->setValue($entity, $data[$field]);
                        $this->originalEntityData[$oid][$field] = $data[$field];

                        continue 2;
                    }

// use the entity association
                    if (isset($data[$field]) && is_object($data[$field]) && isset($this->entityStates[spl_object_hash($data[$field])])) {
                        $class->reflFields[$field]->setValue($entity, $data[$field]);
                        $this->originalEntityData[$oid][$field] = $data[$field];

                        continue 2;
                    }
// Foreign key is NULL
                        $class->reflFields[$field]->setValue($entity, null);
                        $this->originalEntityData[$oid][$field] = null;

                        continue 2;

 

Share this post


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

×
×
  • Create New...

Important Information

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