From:             phpbugs at sevenlight dot com
Operating system: Irrelevant
PHP version:      5.3.0alpha2
PHP Bug Type:     Scripting Engine problem
Bug description:  Error-control operator does not suppress "undefined index" in 
set_error_handler

Description:
------------
A set_error_handler() callback is receiving an error code of 8 (E_NOTICE)
for an undefined index, even though it has been suppressed by the @
operator.  As per the documentation, the value of the error should be 0.

Tested on 5.2 and 5.3.

This is potentially just a documentation problem?

I find that the error code could be useful even if it has been suppressed,
therefore suggesting that an extra variable being passed to the callback
notifying it whether or not the @ operator was used or not would be more
useful.

Reproduce code:
---------------
<?php
function ErrorHandler($iErr, $sError)
{
    if ($iErr) {
        die('This should not happen (' . $iErr . ').  Error should have
been suppressed: ' . $sError);
    } else {
        die('Error suppressed.');
    }
}

set_error_handler('ErrorHandler');

$a = array();
echo @$a[ 'suppress-me' ];
?>

Expected result:
----------------
Error suppressed.

Actual result:
--------------
This should not happen (8). Error should have been suppressed: Undefined
index: suppress-me

-- 
Edit bug report at http://bugs.php.net/?id=46374&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46374&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46374&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46374&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46374&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46374&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46374&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46374&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46374&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46374&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46374&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46374&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46374&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46374&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46374&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46374&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46374&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46374&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46374&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46374&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46374&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46374&r=mysqlcfg

Reply via email to