9

After having upgraded to PHP 5.3, my application was inundated with

"Declaration of ... should be compatible with that of ..."

style errors. I understand the nature of these errors, but I wish to disable them.

The error_reporting setting in php.ini is "E_ALL & ~(E_NOTICE | E_DEPRECATED)", but this error continues to show up. I assumed it was included in E_STRICT, but am I wrong?

hakre
  • 193,403
  • 52
  • 435
  • 836
Ethan
  • 199
  • 1
  • 3
  • 9
  • Doesn't it say what type of error it is? – Alin Purcaru Oct 25 '10 at 17:29
  • 8
    These are indeed `E_STRICT` errors, but but IMO you should fix their causes instead of their reporting. Keep your code clean. – Gordon Oct 25 '10 at 17:58
  • 5
    It's not a matter of clean code. The error is the result of a child class's method having extra arguments than the same method in the parent class. In particular, it's a _defaultAction() function for a controller class. The extended default actions may very well accept arguments the parent class does not. I could easily use func_get_args() to circumvent the issue, but then the method declaration is entirely devoid of relevant meaning. – Ethan Oct 25 '10 at 18:09

2 Answers2

12

It's an E_STRICT error. Change your php.ini setting to E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT)...

But it should be turned off by default (it's not included in E_ALL). So if you're getting them, that means it's being turned on somewhere. The question is, where? Do declare error_reporting(...) anywhere in your files? If so, check them. If not, then be sure you're editing the right php.ini file (check phpinfo())... You could always do a grep for E_STRICT to try to find where it's being turned on...

ircmaxell
  • 163,128
  • 34
  • 264
  • 314
  • 1
    it could also be enabled by using `error_reporting(-1)` which is the recommended way of enabling all errors on development machines. – Gordon Oct 25 '10 at 17:55
  • I changed the setting in php.ini, but the error still appears. It isn't set anywhere else (checked via grep) and altering the error_reporting value at runtime has no effect. Also, the line referenced in the error is always the line where the child class is declared, if this sheds any light on the problem. – Ethan Oct 25 '10 at 18:40
  • 4
    For completeness, `E_STRICT` *is* included in `E_ALL` as of 5.4. – ladenedge Aug 31 '12 at 16:25
0

Let me tell you a good settings.

You can change php.ini, in this file, you can search a sentence as ignore_repeated_errors = Off, you should change off state to on state.

If you also meet the same type of error, you should set Error Level Constants.

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123