wajiw
wajiw

Reputation: 12269

Hide Stack Trace in Exception Response in PHP/Zend

I'm wondering if there is a way to hide the stack trace in an Exception in PHP. I'm running a Zend Amf Server under ZF and would like to handle the faults on the front-end but showing the stack trace (faultDetail) isn't something I want to come across the line.

My next step is to over ride these faults and send my own object back, but I would rather over ride an Exception to just not show the trace.

Upvotes: 0

Views: 2338

Answers (3)

Adrian World
Adrian World

Reputation: 3128

The stack trace is part of your ErrorController.php and /views/scripts/error view scripts. Most people forget that they have created it once and can do with it whatever they please.

Also note that you usually use environments in ZF. With APPLICATION_ENV you can use them to show or hide events depending on your environment.

Upvotes: 1

vascowhite
vascowhite

Reputation: 18430

You can rewrite error.phtml which, by default, is at application\views\scripts\error\error.phtml to show whatever messages you want.

Look at application/controllors/ErrorController.php to see how uncaught exceptions are handled.

Upvotes: 0

Mchl
Mchl

Reputation: 62395

You can write your own exception handler function which will do whatever you wish: http://php.net/manual/en/function.set-exception-handler.php

Upvotes: 0

Related Questions