ID:               36491
 Updated by:       [EMAIL PROTECTED]
 Reported By:      aarone at klamathsystems dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
-Operating System: Windows
+Operating System: *
 PHP Version:      5.1.2
 New Comment:

Write you own language.


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

[2006-02-22 23:42:15] aarone at klamathsystems dot com

Description:
------------
would like to have abstract class instatiation throw exception instead
of raise a fatal error.

One use case would be dynamic library loading when the application has
to discover which library it needs.

What are the obstacles to having exceptions caught for runtime errors
such as attempting to instantiate an abstract class?  I could probably
think of other instances (especially of older functions that could be
upgraded to php5) that could benefit for the robustness this would
allow.

If the tradeoff is for speed or efficiency, that's understandable, but
it would be nice to have an exception that could be caught and
recovered from instead of a fatal error.

Example below:

Reproduce code:
---------------
abstract class Foo
{
}

class Bar extends Foo
{}

try
{
  $foo = new Foo();
}
catch (Exception e)
{
  //Foo is an abstract class, use concrete class Bar instead

  $foo = new Bar();
}



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


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

Reply via email to