View Issue Details

IDProjectCategoryView StatusLast Update
0001948XdebugUncategorizedpublic2021-03-17 08:31
Reporterderick Assigned Toderick  
PriorityhighSeverityfeatureReproducibilityhave not tried
Status assignedResolutionopen 
Product Version3.0.2 
Target Version3.1dev 
Summary0001948: Do not redirect warning and error messages to PHP's error log if an Xdebug log is active
DescriptionKeep 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 

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

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