From: lsole at maresme dot net
Operating system: FreeBSD
PHP version: 4.3.4
PHP Bug Type: Output Control
Bug description: @unserialize() throws E_NOTICE with custom handler
Description:
------------
@unserialize() throws E_NOTICE with custom handler
Reproduce code:
---------------
<?php
function myErrorHandler($errno, $errmsg, $filename, $linenum) {
if ($errno == 0) return;
$error_type = array(0 => 'No Error', 8 => 'Notice'); // just the ones we
need...
echo '<b>' . $error_type[$errno] . '</b>: ' . $errmsg . ' in <b>' .
$filename . '</b> on line <b>' . $linenum . '</b><br>' . chr(10);
}
$a = 'abc123';
error_reporting(E_ALL);
$b = unserialize($a); // throws error because $a is not unserializable
if ($b === false) {echo 'failed!<br>';} else {echo $b . '<br>';}
$b = @unserialize($a); // @ suppresses error
if ($b === false) {echo 'failed!<br>';} else {echo $b . '<br>';}
set_error_handler('myErrorHandler');
$b = unserialize($a); // throws error because $a is not unserializable
if ($b === false) {echo 'failed!<br>';} else {echo $b . '<br>';}
$b = @unserialize($a); // should throw nothing but throws Notice!
if ($b === false) {echo 'failed!<br>';} else {echo $b . '<br>';}
?>
Expected result:
----------------
E_NOTICE errors should not happen when prepending @: the custom handler
should receive $errno = 0
Actual result:
--------------
E_NOTICE error
--
Edit bug report at http://bugs.php.net/?id=27588&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27588&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27588&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27588&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27588&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27588&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27588&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27588&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27588&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27588&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27588&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27588&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27588&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27588&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27588&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27588&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27588&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27588&r=float