ID:               41012
 User updated by:  perching_eagle at yahoo dot com
 Reported By:      perching_eagle at yahoo dot com
 Status:           Wont fix
 Bug Type:         *Compile Issues
 Operating System: *
 PHP Version:      *
 New Comment:

to [EMAIL PROTECTED], thank you for your reasonable explanation.


Previous Comments:
------------------------------------------------------------------------

[2007-04-10 05:19:01] [EMAIL PROTECTED]

Even though exceptions might be normalities in java and other languages
they keep having anexceptional role in PHP and stay theway they are. In
fact PHP is not a pure OO based language and needs to be able to deal
with its core errors in a non object oriented way. Further more PHP is
not perectly designed for applications have long run times but for web
share nothing web applications where the runtime depends on the time a
script needs to finish a request. For that reason a core error simply
needs to be logged rather than having a control mechanism that
reinitializes whatever should be running.

------------------------------------------------------------------------

[2007-04-10 02:46:01] perching_eagle at yahoo dot com

correction= 
   for the first line of the python code in the post before this one.
   
   # add qoutes to the parameter in the function 'input()' 
   num=input("enter a number, do not enter zero:")


 the c programming language and other procedural languages can catch
errors just like object oriented laguages that use exceptions, if the
"try" keyword cannot force the compiler to overlook errors, then you
have to use an "if" statement, just like in "c" and actually write more
code. but if the "try" can suppress errors, you don't have to include
"if" statements and the "throw" keyword, you just write "catch"
statements that can catch each exception and error at runtime, and then
you can continue you code without stopping it or allow the program to
stop after sending a customized message on your site, rather than have
your site or program crash.  you just explicitly throw an exception that
closes the program, after sending a customized message for fatal errors
simple. 
**********************************************************************
to [EMAIL PROTECTED], a zero division error is an exception, it is not a
fatal error, fatal errors require that you reset the program.they are
errors that should not be caught such as linkage errors and thread death
errors and some machine errors. the program should be allowed to end
gracefully but could still catch them if you wish.

------------------------------------------------------------------------

[2007-04-10 02:19:36] perching_eagle at yahoo dot com

well the logic behind exceptions is to help you handle ALL types of
errors and i will show you a similar example in python.

 python code:

 num=input('enter a number, do not enter zero:)
 try:
     print 34/int(num)
 except ZeroDivisionError:
     print "error,you entered zero"

 (if you enter 2) output: 17

 (if you enter 0) output: error, you entered zero
 
  #java does exactly the same thing.
 

simple code, i didn't have to explicitly throw any exception (using the
throw keyword) or include an "if" statement. this obeys the rule of keep
things simple, and the "try" keyword actually does something, as opposed
to being a mere decoration as it is now in PHP.

------------------------------------------------------------------------

[2007-04-08 15:11:42] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Fatal errors are not exceptions and therefor try {} does nothing to 
catch them.

------------------------------------------------------------------------

[2007-04-06 21:00:29] perching_eagle at yahoo dot com

<?php
   $e="there is an error";
 try{
      throw new Exception ($e);//the throw can exist outside the try 
                               //block (or simply, almost anywhere)
    }
 try{
      $err=34/0;//the compiler should ignore this error
                //it is legal because it is in a try block
     }
    $error=34/0;//the compiler should act on this error
 ?>             //this error is illegal

  however zend engine will flag the error in the second try block
  (an abnormal behavior) instead of ignoring it.

note: when flagging other posters comments as bogus, give logical
reasons for doing so.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/41012

-- 
Edit this bug report at http://bugs.php.net/?id=41012&edit=1

Reply via email to