Вопрос

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