Table of Contents

Request for Comments: Default error_reporting to include E_NOTICE

Abstract

This proposal suggests that PHP 6 change the php.ini.* default settings to include E_NOTICE.

This proposal specifically does not address E_STRICT nor E_DEPRECATED.

Others may wish to create RFCs for that, or merge them. I would prefer to consider them independently, as the reasoning for each is different.

Why?

I believe most experienced users will agree that E_NOTICE is a good tool for catching uninitialized variables and array elements that can sometimes point out logical errors in code.

While some do not use it, and others turn it off in PRODUCTION for performance purposes, as a development tool for beginners to PHP, it has a great deal of value.

Experts can trivially change the setting in any/all of the available locations for settings.

Certainly, far too many beginners create mailing list traffic with questions that boil down to misspelled variables or similar errors, because webhosts generally stick to default settings.

Including E_NOTICE will reduce the number of such questions and improve the skill-set of new users to PHP, by forcing them to write (arguably) better code, until they can make an informed decision to select their own preferred error_reporting levels.

One can argue that since PHP automatically initializes all variables, initialization is not strictly needed. While this is true:

History

This has been discussed on the mailing list several times.

Generally it devolves into whether we should also include E_STRICT and/or E_DEPRECATED and goes nowhere, as I recall.

Hence my preference for proposing E_NOTICE and only E_NOTICE, independently of the others.

I do apologize if this has been formally proposed and voted down before. I searched the RFCs for it, and did not find it.

Proposal and Patch

The php.ini.* files would be altered to: error_reporting = E_ALL

Even I could probably write a patch for that, though such a trivial patch is probably more quickly implemented by somebody with write karma.

Changelog

2012-02-27 Initial proposal.