<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Albert Fama &#187; error messages</title>
	<atom:link href="http://albertfama.com/tag/error-messages/feed/" rel="self" type="application/rss+xml" />
	<link>http://albertfama.com</link>
	<description>Freelance Web Programmer - specializing in PHP &#38; MySQL</description>
	<lastBuildDate>Fri, 20 Nov 2009 16:06:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>NOTICES mean something</title>
		<link>http://albertfama.com/php/notices-mean-something/</link>
		<comments>http://albertfama.com/php/notices-mean-something/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 06:34:36 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Error Handling]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[error messages]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=264</guid>
		<description><![CDATA[In numerous books and articles the general consensus seems to be that for a production environment Errors and Warnings should be turned on and Notices turned off; as opposed to the development environment where error reporting should be set to E_ALL (report all errors). The reasoning behind this is, Errors and Warnings mean something serious [...]]]></description>
			<content:encoded><![CDATA[<p>In numerous books and articles the general consensus seems to be that for a production environment Errors and Warnings should be turned <strong>on</strong> and <a href="/php/errors-and-error-messages-deciphered/#notice">Notices</a>  turned <strong>off</strong>; as opposed to the development environment where error reporting should be set to E_ALL (report all errors). The reasoning behind this is, Errors and Warnings mean something serious has gone wrong with the script and you (as the developer) need to know about it. Notices on the other hand are kind of disregarded as a nuisance in production.</p>
<p>I completely disagree with this point of view. If I write code which is not intended to generate Notices, then as the developer I want to know if and when Notices are being generated in <strong>any</strong> environment.</p>
<p>Notices are very helpful in tracking down logical errors or bugs, which cause the script not to function as expected.  In PHP they are normally generated when using a previously undeclared variable. Technically speaking there is nothing wrong with this in PHP, other programming languages are not so forgiving. </p>
<p>I personally started declaring all variables when I began to focus on the security implications of using undeclared variables (we&#8217;ll save that information for another post). After getting in the habit I found that I was able find logical errors during development even before I noticed that a bug existed. After realizing this, I now never release code which is know to generate notices. I have also started setting error reporting to E_ALL in <strong>all</strong> environments.</p>
<p>I understand that this is not feasible for everyone. It may not be possible in a professional working environment because of dealing with legacy code. Another issue could arise if you use third-party code which has not subscribed to this way of thinking. Although personally, I feel this is not an excuse there is no reason you can&#8217;t get in there and &#8216;fix&#8217; their script.  </p>
<h5>A word of warning</h5>
<p>I was once hired to fix numerous bugs on a site, all were a fairly obvious fix, but one in particular had me stumped.  I turned on notices when attempting to debug the problem and ended up with an error log that contained over 250 notices for every page load. Since this was a dev environment setup by the client for my use, it was no big deal, but if it were a heavily trafficked live site, there could have been some serious implications.</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=264">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/php/notices-mean-something/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

