문제

We have a problem in our staging environment. The try-catch blocks aren't working as expected, and we couldn't find why.

We are only running this test snippet:

try {
    throw new Exception('teste');
} catch (Exception $e) {
    echo $e->getMessage(); exit;
}

Running that, we got an "Uncaught exception" error, and not the exception message. We're not using namespaces.

Does anybody know what's going on?

We're using PHP 5.4.17, Apache 2.2.2, RHEL linux.

도움이 되었습니까?

해결책

Found the answer!

This is a bug in eAccelerator. I just disabled it, and the code magically worked just fine.

I saw it in this thread: PHP5: Why is try/catch failing?

I had googled it before, I just haven't found this thread. Looks like upgrading the extension solves the problem as well.

Thank all of you that answered this question.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top