XDebug code coverage in PHP 7 doesn’t reach all code

I was noticing a lot of white (untouched) code in my XDebug code coverage reports however the method signatures at the top were all green and 100% covered. After some searching I found this thread (don’t bother reading) which led to this thread (scroll fast and occasionally read) which showed some awesome debugging by JoepRoebroek. Bug tracker here.

Ultimately PHP 7 introduced (or maybe “started using differently”) a new constant with bitflags that gets used for ce_flags which happened to collide with the bitflag on a constant that XDebug had been using for years. Luckily the fix was just to shift some bits in XDebug.

Example of XDebug 2.4 incorrectly saying all methods are covered but showing untouched code.

Example of XDebug 2.5.1 correctly showing code coverage.