#41012 [Opn->Bgs]: exception handling
| From: | derick@php.net | Date: | Fri, 06 Apr 2007 18:55:16 +0000 |
| Subject: | #41012 [Opn->Bgs]: exception handling | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-111174@lists.php.net to get a copy of this message | ||
ID: 41012
Updated by: derick@php.net
Reported By: perching_eagle at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: *Compile Issues
Operating System: windows xp
PHP Version: 5.2.1
New Comment:
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
.
Previous Comments:
------------------------------------------------------------------------
[2007-04-06 18:43:25] perching_eagle at yahoo dot com
Description:
------------
the compiler ought to bypass exceptions in "try" blocks, and allow a
"catch block" to catch the exception at runtime. in other words, "try"
blocks should turn compile-time errors to run-time errors. try blocks
shouldn't depend on the throw keyword before throwing exceptions, errors
in try blocks should automatically cause exceptions to be thrown.
otherwise the current Exception class is only as good as this statement
"if(class_exists(Book)){//main code} else{//warning code}" for the code
in my example.
Reproduce code:
---------------
<?php
try{
$err=new Book(); //class Book does not exist
//more code
}
catch(Exception $e){
print "class does not exist";
exit();
// or throw another exception that ends the program
//in another block.
}
Expected result:
----------------
output:(should look like this)
class does not exist
(python and java behave like this, i hope there will be some
consistence in logic, among open source languages )
Actual result:
--------------
program does not compile,
error message: Fatal error (actually says Fatel error),
class 'Book' not found on C:/XXXX/XXX
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41012&edit=1