php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46425 Default Error Reporting encourages lax programming
Submitted: 2008-10-30 04:31 UTC Modified: 2008-10-30 22:19 UTC
From: wbowmer at fairfaxdigital dot com dot au Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3.0alpha2 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wbowmer at fairfaxdigital dot com dot au
New email:
PHP Version: OS:

 

 [2008-10-30 04:31 UTC] wbowmer at fairfaxdigital dot com dot au
Description:
------------
The php.ini-dist file in the archive has settings designed for a live install, but also has settings intended for a development install. In particular, error_reporting is set to disable Notice errors. Unfortunately, this encourages a number of bad programming habits, most notably using variables without intializing them. This habit is unfortunately common in PHP code and significantly hinders debugging.

I've like to request future versions default to error_reporting = E_ALL (i.e. enable Notice errors) in order to give PHP programmers just that little bit extra encouragement to be better programmers.


Reproduce code:
---------------
n/a


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-30 10:28 UTC] scottmac@php.net
Interesting idea, but the ini file is designed for production sites not development. You can turn E_ALL on yourself and use display_errors to hide from the production system.
 [2008-10-30 22:19 UTC] wbowmer at fairfaxdigital dot com dot au
Is the file php.ini-dist really designed for production? It seems to be a bit uncertain on that score.

1. The first comment, lines 6-11 clearly state the goal for this file is for a development environment and that a production environment should use php.ini-recommended.

2. There are several settings designed for a development environment, such as display_errors = on, output_buffering = off and log_errors = On.

3. OTOH, error_reporting has Notices disabled, whilst php.ini-recommended has then enabled. :-/ This is backwards.

There are other inconsistencies between the two php.ini files, but my major point was that php.ini-dist is the one normally installed - thus it is used largely _as-is_ for *development* environments and should have defaults to encourage better programming. My concern wasn't how the defaults apply to me - but how they apply to people who don't bother changing them.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 01:01:29 2024 UTC