1

I want to stop Stack Traces from appearing in my fatal errors in PHP.

My PHP code:

throw new ErrorException('Failed here!', 10);

Results in:

Fatal error: Uncaught exception 'ErrorException' with message 'Failed here!' in C:\file\path\File.php:25 Stack trace: #0 C:\xampp\htdocs\sample-integrations\site-folder\index.php(18): Realex\Transaction::create(Array) #1 {main} thrown in C:\file\path\File.php on line 25

being output in the browser. How can I remove the stack trace?

Azat
  • 6,745
  • 5
  • 31
  • 48
dazziola
  • 193
  • 1
  • 3
  • 14
  • 4
    `try {` your code and then `} catch(ErrorException $e) {` and catch it! `}` – Rizier123 May 12 '15 at 16:21
  • 1
    Do you want to hide just the stacktrace? If so, why? – Halcyon May 12 '15 at 16:22
  • 1
    catching the exception ? – Answers_Seeker May 12 '15 at 16:22
  • Error messages and stack traces are not for decoration purposes – they should help you to identify possible bugs in your code. What you are asking for sounds like cosmetic surgery. You should always print as much information as possible during development and suppress output of error messages on the production environment completely. – feeela May 19 '15 at 19:39

1 Answers1

0

This may have been answered by this https://stackoverflow.com/a/17766961/400114? Use the xdebug_disable() function in the XDebug extension.

Not ideal, but might do the trick!

Community
  • 1
  • 1
Owen O Byrne
  • 417
  • 3
  • 10