MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001586XdebugUsage problems (Wrong Results)public2018-11-12 12:182018-12-03 10:30
ReporterLanaZem 
Assigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version2.6.0 
Target VersionFixed in Version 
Summary0001586: Error notifier doesn't respect error_reporting level
DescriptionXdebug sends error notification even if they are disabled in php.ini
Steps To Reproduce1) Set error_reporting to `E_ALL & ~E_NOTICE`
2) Create a php script:
```
<?php

echo $undefined;
```
3) Make sure that regular execution doesn't generate PHP Notification
4) Start Xdebug debug session
5) Enable notify feature
```
<- feature_set -i 5 -n notify_ok -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" [^] command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
```
6) Finish debug session
7) Note that there's a notification in xdebug log:
```
-> <notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" [^] name="error"><xdebug:message filename="file:///path/to/project/withNotice.php" [^] lineno="6" type="Notice"><![CDATA[Undefined variable: x]]></xdebug:message></notify>
```
Additional InformationPhpStorm issue: https://youtrack.jetbrains.com/issue/WI-43921 [^]
TagsNo tags attached.
Operating System
PHP Version7.1.0-7.1.4
Attached Fileslog file icon xdebug_with_notify.log [^] (13,202 bytes) 2018-11-12 12:18

- Relationships

-  Notes
(0004733)
derick (administrator)
2018-12-01 11:28

I saw the issue when you submitted it, but so far I had neglected to reply as I am unsure whether Xdebug is doing anything *wrong* here. I'm going to argue that it doesn't.

As Xdebug is a *debugging* tool, it should provide as much information as it can. When an IDE sets the ``-n notify_ok -v 1`` it indicates that the debug engine may send the IDE notifications. These notifications are not necessarily restricted to ``error`` notifications (https://xdebug.org/docs-dbgp.php#error-notification [^]), but can in the future also include ``breakpoint_resolved`` notifications (these are currently unimplemented in Xdebug today, but part of a future feature, as requested by the PhpStorm team).

The DBGp specification says:

> When a language engine creates a debugging notification, the debugger engine MAY convert this to a DBGp notification.

The language engine (PHP) creates a debugging notice (including formatting, stack traces, etc) regardless of whether PHP outputs it to the screen. The decision to show debugging information is taken much later. This means that leaving many notices unfixed in your PHP script actually creates quite a slow down to begin with (even if Xdebug is not involved at all).

As a debugging notice is created, Xdebug decides to send it over the DBGp connection to the IDE, to point out that there is a mistake in the script. I would say that it should continue to do so.
(0004742)
LanaZem (reporter)
2018-12-03 10:30

Thank you for the answer!
Ok, it make sense.

We'll think how it should be fixed on PhpStorm side. Probably we should show error according to error level but notify user if there are too much hidden notifications and warnings.

- Issue History
Date Modified Username Field Change
2018-11-12 12:18 LanaZem New Issue
2018-11-12 12:18 LanaZem File Added: xdebug_with_notify.log
2018-12-01 11:28 derick Note Added: 0004733
2018-12-02 18:45 derick Assigned To => derick
2018-12-02 18:45 derick Status new => feedback
2018-12-03 10:30 LanaZem Note Added: 0004742
2018-12-03 10:30 LanaZem Status feedback => assigned


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker