Drupal is now (almost?) E_STRICT complaint. At least the complete test suite now runs without strict warnings (see #348448: Always report E_STRICT errors).
There is an E_STRICT issue being handled in #325827: Avoid PHP strict timezone warnings by calling date_default_timezone_set in bootstrap, but apart from that Drupal core appears to work pretty good with E_STRICT warnings enabled, though there may still be a few problems here and there.
Dries suggests that we raise the error reporting level during the development cycle. This patch sets error_reporting to E_ALL | E_STRICT in default.settings.php. We may want to remove this prior to releasing D7, though I suggest that we leave it to encourage users and contrib module developers to write code as compatible and future proof as possible.
I know this may cause some additional work when porting existing modules to D7. However, these problems are usually easy to fix and are probably only a minor part of upgrading to D7.
I am postponing this until at least #325827: Avoid PHP strict timezone warnings by calling date_default_timezone_set in bootstrap has been fixed.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | strict-error-reporting-2.patch | 3.01 KB | c960657 |
| strict-error-reporting-1.patch | 1.48 KB | c960657 |
Comments
Comment #1
damien tournoud commentedI support the change to E_STRICT, but http://api.drupal.org/api/function/drupal_initialize_variables/7 is the good place to put it.
Comment #2
c960657 commentederror_reporting is now set to
E_ALL | E_STRICTin drupal_initialize_variables().Comment #3
dries commentedThis patch no longer applies and will need a re-roll.
Comment #4
damien tournoud commentedAnyway, this should be:
Comment #5
c960657 commentedE_ALL covers all warnings, notices etc. except E_STRICT (and in PHP6 it actually covers all warnings etc. including E_STRICT), so or'ing with error_reporting() doesn't change anything.
Comment #6
mfbYou also need to set E_ALL | E_STRICT in php.ini to catch the compile-time strict errors in core. This mostly involves some incorrect method signatures in the db layer. I patched a few of these over in http://drupal.org/node/325827#comment-1124273 a while back.
Edit: updated patch at #351898: Database API is not E_STRICT compatible.
Comment #7
dave reidWe don't need the following segment because we now have an option to select which errors are displayed.
Comment #8
mfbThis patch is tiny and not useful on its own so marking as a duplicate of #348448: Always report E_STRICT errors