Notice errors with set_error_handler

This is a discussion on Notice errors with set_error_handler within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Questions in comments. Thanks you. Greetings, - John <? error_reporting (E_ALL); function myErrorHandler($errno, $errstr, $errfile, $errline) { echo "<br&...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-24-2003
JohnVT
 
Posts: n/a
Default Notice errors with set_error_handler

Questions in comments.

Thanks you.

Greetings,

- John

<?
error_reporting (E_ALL);

function myErrorHandler($errno, $errstr, $errfile, $errline) {
echo "<br>Error number $errno \"$errstr\" in $errfile on line
$errline.<br>";
}

$x = $a;
@$x = $b;

set_error_handler("myErrorHandler");
$x = $c;
@$x = $d;

/*

Displays:

Notice: Undefined variable: a in
c:\data\htdocs\projects\photobook\testerror.php on line 8
Error number 8 "Undefined variable: c" in
c:\data\htdocs\projects\photobook\testerror.php on line 11.
Error number 8 "Undefined variable: d" in
c:\data\htdocs\projects\photobook\testerror.php on line 12.

1) Why does it fall over @$x = $d (with my own error handler) and not over
@$x = $b with the standard error handler?
2) From the manual I understood only E_USER_* errors were handled by the
set_error_handler. Why is E_NOTICE given to myErrorHandler()?

*/

?>



Reply With Quote
  #2 (permalink)  
Old 07-24-2003
Janwillem Borleffs
 
Posts: n/a
Default Re: Notice errors with set_error_handler


"Janwillem Borleffs" <jwb@jwbfoto.demon.nl> schreef in bericht
news:3f2046d9$0$28907$1b62eedf@news.euronet.nl...
>
> It actually falls over the lines
> $x = $a;
> @$x = $b;
>


Correction, it falls over the first line only. The error message is
surpressed in the second line with the @-sign.

JW




Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0