View Issue Details

IDProjectCategoryView StatusLast Update
0001948XdebugUncategorizedpublic2021-10-04 09:32
Reporterderick Assigned Toderick  
PriorityhighSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.0.2 
Target Version3.1devFixed in Version3.1.0 
Summary0001948: Do not redirect warning and error messages to PHP's error log if an Xdebug log is active
Description

Keep critical errors still going to PHP's error log though.

TagsNo tags attached.
Operating System
PHP Version8.0.0-8.0.4

Relationships

has duplicate 0001920 closedderick When discover_client_host is active, failure to discover shows in the main PHP error log, even when a log is specified 
has duplicate 0001975 closedderick always get "time-out connecting to debugging client" when client is not running 

Activities

tomjn

2021-02-18 12:24

reporter   ~0005683

I suspect something like this in log.h would do the job in src/lib/log.c:

<code>
static inline void xdebug_php_log(int channel, int log_level, const char error_code, const char message)
{
if (XG_LIB(log_file) && log_level > XLOG_CRIT) {
return;
}
</code>

tomjn

2021-02-18 12:44

reporter   ~0005684

I created a draft PR at https://github.com/xdebug/xdebug/pull/726, I have some work to do today before I can circle back to it but I see that several existing test cases need to be updated before I set it ready to review

derick

2021-02-19 12:21

administrator   ~0005687

That code is not right, as it would no longer redirect these messages to the PHP error log even if the xdebug log isn't configured. Also, please read https://github.com/xdebug/xdebug/blob/master/CONTRIBUTING.rst and stick to the existing coding standards (NO SPACES! ;-) ).

tomjn

2021-02-19 14:16

reporter   ~0005690

I hadn't realised it used spaces, that's a mistake, likely my editor trying to be clever with a new language. And I did read the contributor document, I actually tried to create a PR several times and removed them because I realised I'd made a mistake with the PR title, the commit message, etc, it was quite stressful. Have you considered an .editorconfig so that this mistake isn't possible?

Otherwise I'm unsure how to check if the log file is active, and assumed that checks used elsewhere would do it. In hindsight the check should be moved below the if statement underneath. I used that particular check based off of https://github.com/xdebug/xdebug/blob/5e29284c45cbfdf968e39479687db7913b563d0a/src/lib/log.c#L60-L62, that if the log_file was false then that meant there was no handle open to the logfile. Since xdebug_internal_log is called before xdebug_php_log, log_file would be available if internal logging was possible, and if it had to be intialised it would have been done beforehand

derick

2021-04-23 15:13

administrator   ~0005861

https://github.com/xdebug/xdebug/pull/738

derick

2021-04-26 08:23

administrator   ~0005862

https://github.com/xdebug/xdebug/pull/738

Issue History

Date Modified Username Field Change
2021-02-18 12:06 derick New Issue
2021-02-18 12:06 derick Status new => assigned
2021-02-18 12:06 derick Assigned To => derick
2021-02-18 12:24 tomjn Note Added: 0005683
2021-02-18 12:44 tomjn Note Added: 0005684
2021-02-19 12:21 derick Note Added: 0005687
2021-02-19 14:16 tomjn Note Added: 0005690
2021-03-17 08:30 derick Priority normal => high
2021-03-17 08:31 derick Relationship added has duplicate 0001920
2021-04-23 15:13 derick Note Added: 0005861
2021-04-26 08:23 derick Status assigned => closed
2021-04-26 08:23 derick Resolution open => fixed
2021-04-26 08:23 derick Fixed in Version => 3.1dev
2021-04-26 08:23 derick Note Added: 0005862
2021-05-19 12:19 derick Relationship added has duplicate 0001975
2021-09-05 16:15 derick Fixed in Version 3.1dev => 3.1.0beta1
2021-10-04 09:32 derick Fixed in Version 3.1.0beta1 => 3.1.0