mon
mon

Reputation: 115

Strict Standards Error in CakePhp?

i am using xampp v3.1.0 3.1.0 and cakephp 1.2.10 but I've got these two errors.

Strict Standards: Redefining already defined constructor for class Object in E:\xampp\htdocs\projectname\cake\libs\object.php on line 62

Strict Standards: Non-static method Configure::getInstance() should not be called statically in E:\xampp\htdocs\projectname\cake\bootstrap.php on line 46

Thanks in advance

Upvotes: 3

Views: 4939

Answers (2)

AD7six
AD7six

Reputation: 66198

E_STRICT warnings are warnings, not errors - know that the problem is PHP 5.4+ specific:

E_STRICT (integer)

Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.

Since PHP 5 but not included in E_ALL until PHP 5.4.0

you can ignore them (after taking steps to prevent users seeing them).

There are several options at your disposal, upgrading is the most appropriate. If it is an application you are activity maintaining - It would be best to upgrade to the current stable (2.4 at the time of writing) but if that's not the case/desirable/possible - upgrading is still the most appropriate solution:

Upgrade to latest 1.3

Recommended

1.3.17 Is the last release in the 1.x release cycle. It is php 5.4 compatible, and includes innumerous bug and security fixes. It does have some migration steps but they are typically no more than a few minutes (or at most, hours) work. Upgrading is a simple process - just download the new version and replace the cake folder.

Upgrade to latest 1.2

easy

1.2.12 Is the last 1.2 minor release and is also php 5.4 compatible, upgrading to this version has no risk of compatibility problems with your existing application code. Upgrading is a simple process - just download the new version and replace the cake folder.

Silence E_STRICT warnings yourself

easiest (but also hacky)

The change required to make 1.2 php 5.4 compatible is actually quite trivial - you can apply it yourself (just look for error_reporting and add & ~E_STRICT to the setting). Editing the cake folder is of course not recommended - but if you're looking for the least-change solution: this is it.

Upvotes: 7

Roberto Maldonado
Roberto Maldonado

Reputation: 1595

Seems that old CakePHP doesn't play very well with newer versions of PHP. Please have a look here: http://i.justrealized.com/2009/cakephp-php-deprecated-error-warning/

Be aware that CakePHP 1.2 is deprecated. It's recommended to use at least 1.3 if you want to stick to 1.x version, as there aren't major differences with 1.2.

But if you still insist, you can downgrade PHP to 5.2 or lower to be compatible

Upvotes: 2

Related Questions