0

Possible Duplicate:
Declaration of Methods should be Compatible with Parent Methods in PHP

I just installed php 5.4.4. and I all of a sudden get a strict warning. Does someone know what it is?

Strict (2048): Declaration of User::beforeSave() should be compatible with Model::beforeSave($options = Array) [APP/Model/User.php, line 3]
Community
  • 1
  • 1
waterschaats
  • 994
  • 3
  • 18
  • 32
  • 4
    What is unclear of the message? – PeeHaa Aug 08 '12 at 10:57
  • 1
    That is for what normally interfaces are for, but instead of static stacking, I suggest you switch to [`Super::$tatic`](http://i.imgur.com/RJEsz.png) sooner or later. It is just the way to do PHP cake or anything else. – hakre Aug 08 '12 at 10:58
  • 1
    Also please contact the software vendor and ask in support if PHP 5.4.4. is supported by cakephp. Not that you use an unsupported PHP version with your framework. – hakre Aug 08 '12 at 11:01

2 Answers2

4

In APP/Model/User.php, change the declaration to match the class it extends, Model

function beforeSave( array $options ){
    ...
postpostmodern
  • 1,986
  • 1
  • 14
  • 22
1

If you look closely, you'll notice that the methods signature differs. Model::beforeSave() accepts an optional array, whilst your method doesn't accept anything.

However, the message is not severe. It's a strict, meaning that you're breaking standards, but is not like you're on Titanic.

DavidS
  • 1,660
  • 1
  • 12
  • 26
  • 3
    " but is not like you're on Titanic" -> Yes he is. He's using Cake. It's the Titanic and it's sinking fast! ;) – PeeHaa Aug 08 '12 at 11:02
  • 2
    It means that you are *on* Titanic, but the ice-block is somewhere in the future to illustrate that picture a bit ;) – hakre Aug 08 '12 at 11:02
  • "Strict standards? BAH haha, this app is unsinkable! UNSINKABLE!" – Dan Lugg Mar 15 '13 at 16:59