From:             perching_eagle at yahoo dot com
Operating system: windows xp
PHP version:      5.2.1
PHP Bug Type:     *Compile Issues
Bug description:  exception handling

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 bug report at http://bugs.php.net/?id=41012&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41012&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41012&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41012&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41012&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41012&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41012&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41012&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41012&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41012&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41012&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41012&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41012&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41012&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41012&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41012&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41012&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41012&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41012&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41012&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41012&r=mysqlcfg

Reply via email to