Jump to content
The Uniform Server Community
JiPER

Exceptions

Recommended Posts

Hi, I've got a problem with exceptions in PHP5. When I throw exception, it doesn't propagate through the stack and fails with unhandled exception error, when tryin to catch it somewhere else in the code. Here's example of code, which doesn't work on my Uniform Server, but it works on standard webhosting.

 

<?php

function go($number) {
if ($number == 0) {
	throw new Exception('Zero');
}
}

try {
go(0);
}
catch (Exception $e) {
echo $e->getMessage();
}

?>

 

I've got the latest version of the Uniform Server - 3.5 Apollo.

 

Please can anyone help? Thanks.

Share this post


Link to post
Share on other sites

The following maybe of interest:

 

From apanel select eAccelerator (left menu)

Now navigate to Actions (main screen) you will see five buttons.

Starting from the top click each button in turn. (Disables Caching and Optimizer)

 

Run your page with the problem code.

 

Well! I ran your test code above and found it works fine, I have no idea what the cause is but suspect that eAccelerator caching could be the culprit! :D

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Great, it's working now. :D I was very unhappy about it. Hope it won't repeat, but at least I know how to fix it now. Thank you very much! :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...