PHP5: Why is try/catch failing?


PHP5: Why is try/catch failing?



On my XAMPP/Win XP build, PHP5.2.3 fails to catch any exceptions. None of the examples work, and this:

try {     throw new Exception('Fail'); } catch (Exception $e) {     echo 'Succeed'; } 

...results in:

Fatal error: Uncaught exception 'Exception' with message 'Fail' in M:\path\to\test.php:4 Stack trace: #0 {main} thrown in M:\path\to\test.php on line 4

All of PHP's error settings seem standard. Server is Apache/2.2.4




System.ExecutionEngineException Failure

1:



Exception for missing data
This depends on eAccelerator's build in XAMPP.


How can I avoid using exceptions in C++?
At one point, it had trouble optimizing try/catch statements and just ignored them..
WCF The service '/myservice.svc' activated due to an exception during compilation
The problem was in 0.9.5.


SPWeb disposing himself and causing exception
XAMPP currently is bundled with eAccelerator 0.9.5.3, although it is disabled by default.


Handling static constructor exceptions in a multithreaded application
So this might not be your issue..
g++ problem: exception not caught
According to the ChangeLog, XAMPP hasn't used PHP 5.2.3 and Apache 2.2.4 in a LONG time, which is also around the time of the eAccelerator bug.


LINQ problems with NText, Text and Image on SQL server
I recommend checking your eAccelerator version and possibly upgrading XAMPP..


2:


I get "Succeed" as output running your script, both standalone on command line and via apache on a webserver as well as in XAMPPLITE.

Dunno what's different from your setup.



78 out of 100 based on 48 user ratings 798 reviews

@