C.Liddell
C.Liddell

Reputation: 1082

PHP 7.0.2 performs backtrace on error

I'm running PHP version 7.0.2 on OS X El Capitan and every time I execute a PHP script that contains some erroneous code, it reports the error and then seems to perform a backtrace automatically. I'm not so sure if this is a new feature in PHP 7, however I cannot seem to find mention of it anywhere or anyone else who's facing a similar problem.

For Example:

<?php
   echo $a;
?>

Will return the following output if executed from CLI:

PHP Notice:  Undefined variable: a in /Path/to/file.php on line 2
PHP Stack trace:
PHP   1. {main}() /Path/to/file.php:0

Notice: Undefined variable: a in /Path/to/file.php on line 2

Call Stack:
    0.0002     350944   1. {main}() /Path/to/file.php:0

Any insight on what might be causing the problem is welcome. Thanks.

Upvotes: 0

Views: 442

Answers (2)

BillK
BillK

Reputation: 317

Adding xdebug.default_enable=0 to php.ini will prevent XDebug from sending stack traces without giving up profiling and debugging capabilities.

Upvotes: 0

C.Liddell
C.Liddell

Reputation: 1082

The problem I was facing was not with PHP 7.0.2 itself, but with an extension that had somehow become enabled called XDebug. XDebug which is intended for advanced error reporting was causing problems in another project of mine and by disabling it, it seemed to solve my problem. In order to disable XDebug all you need to do is modify your php.ini file and change the values debug.remote_autostart, debug.default_enable, and debug.remote_enable from 'on' to 'off'.

Upvotes: 1

Related Questions