Why should I fix E_NOTICE errors? Pros and cons
<p>----EDIT: maybe question must be like this: should I use E_NOTICE enabled on live server?</p>

<p>As I can see in <a href="http://stackoverflow.com/questions/5073642/why-should-i-fix-e-notice-errors">Why should I fix E_NOTICE errors?</a>
everybody is again with using isset() to omit notices. I have read pros, but how about code readability?</p>

<p>Let's examine some code:</p>

<pre class="lang-php prettyprint-override"><code>if ($this-&gt;_oldattributes['category_id'] != $tattr['category_id']
    || $this-&gt;_oldattributes['deal_id'] != $tattr['deal_id']
) {
</code></pre>

<p>Clear to understand what I want here, right?</p>

<p>Lets add isset() to omit notices</p>

<pre class="lang-php prettyprint-override"><code>$old_cat_id = isset($this-&gt;_oldattributes['category_id']) ? $this-&gt;_oldattributes['category_id'] : null;
$new_cat_id = isset($tattr['category_id']) ? $tattr['category_id'] : null;
$old_deal_id = isset($this-&gt;_oldattributes['deal_id']) ? $this-&gt;_oldattributes['deal_id'] : null;
$new_deal_id = isset($tattr['deal_id']) ? $tattr['deal_id'] : null;
if ($old_cat_id != $new_cat_id || $old_deal_id != $new_deal_id) {
</code></pre>

<p>Not bad, but now I need more time to understand what is happening here</p>

<p>A few bits about debugging - I never wasted a day to debug errors caused by not initialized variable. Yes, maybe half of a hour was wasted to slide down into the classes/functions but this not a big waste when comparing to losing code readability IMHO?</p>

<p>A few bits about performance - <a href="http://seanmonstar.com/post/909029460/php-error-suppression-performance" rel="nofollow">http://seanmonstar.com/post/909029460/php-error-suppression-performance</a></p>

<pre><code>The difference was that suppressing the notice took 100% as long as just checking if it existed first"
</code></pre>

<p>Test was performed on 1000000 supressions. How many of them appears in your code, even if you use Zend+Doctrine+something else? And how many time does it takes in comparison to DB connections, etc.?</p>

<p>Maybe I just not used to write correct code(used only PHP for long time now).
Let me hear your thoughts please...</p>

<p>-----EDIT:
We have moved project to server which displaying E_NOTICEs, that's why I'm asking this. I don't know why this is a big problem to switch them off?</p>

<p>-----EDIT: some more code:</p>

<pre class="lang-php prettyprint-override"><code>class Item extends CActiveRecord {
    private $_oldattributes = array();

public function afterFind()
{
    // Save old values
    $this-&gt;_oldattributes = $this-&gt;getAttributes();
    $this-&gt;_oldcategory = $this-&gt;category;
    $this-&gt;_olddeal = $this-&gt;deal;
}
</code></pre>

<p>so I will have null if old attributes not exists
and </p>

<pre><code>$tattr = $this-&gt;getAttributes();
$this-&gt;_oldattributes['category_id'] != $tattr['category_id']
</code></pre>

<p>will give me what i need, and there is no errors, right?</p>

<p>-----EDIT: same with not an object error, in Yii when I have set up relations some objects may not be initialized, yes there is a kind of error, because have null value and not initialized in this case is real error sometimes</p>

<pre class="lang-php prettyprint-override"><code>$this-&gt;deal-&gt;item-&gt;id != $this-&gt;_olddeal-&gt;item-&gt;id
</code></pre>

<p>-----EDIT: </p>

<pre><code>This may trigger a notice but will work as intended, so you ignore the notice:
if ($_GET['foo']) ...
</code></pre>

<p>Problem is that I can't ignore this, because it still throws notice
and everytime when i use this i must write:</p>

<pre><code>if (isset($_GET['foo']) &amp;&amp; $_GET['foo']) ...
</code></pre>

<p>or</p>

<pre><code>if (@$_GET['foo']) ...
</code></pre>
