View Issue Details

IDProjectCategoryView StatusLast Update
0002263XdebugStep Debuggingpublic2024-04-22 10:39
Reporterduzenko Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0002263: Ignore warnings on select lines?
Description
    public function getFileAsString() {
        $path = ...
        return file_get_contents( $path );
    }

When the file $path does not exist I get a breakpoint in my IDE - which is what I usually want on PHP warnings
However this particular function (getFileAsString) was designed to return false in such cases and it's intended behavior, so I would like XDebug not to stop here.

I'd think that adding an '@' should generally prevent warning breakpoints but in practice it does not work. Is there any other to suppress warnings on specific lines of code?

Steps To Reproduce
    public function getFileAsString() {
        $path = '\tmp\exists.not';
        return file_get_contents( $path );
    }
TagsNo tags attached.
Operating System
PHP Version8.2.0-8.2.9

Activities

duzenko

2024-04-22 10:39

reporter   ~0006928

I understand that I can add a branch and check the condition manually. However in general I'd like to avoid xdebug-specific code that does not do anything useful on production

        if( !file_exists( $path ) ) return false;

Issue History

Date Modified Username Field Change
2024-04-22 10:37 duzenko New Issue
2024-04-22 10:39 duzenko Note Added: 0006928