Fix Runtime::getCurrentSettings() forwarding spurious empty overrides for php.ini-only extensions#100
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.1 #100 +/- ##
============================================
- Coverage 55.36% 54.14% -1.23%
- Complexity 92 95 +3
============================================
Files 2 2
Lines 177 181 +4
============================================
Hits 98 98
- Misses 79 83 +4 ☔ View full report in Codecov by Sentry. |
|
These changes also fix the root cause of sebastianbergmann/phpunit#6673, where PCOV-based code coverage was reported as
PCOV is a textbook case. On the affected machine PCOV is loaded by a conf.d file that only loads the extension: [pcov]
extension="…/pcov.so"It sets neither With PHPUnit forwards these settings as The new logic implemented in this pull request only forwards a value when there is actual evidence that it was overridden: an empty value that is absent from both the loaded INI files and the compiled-in defaults is left alone, because there is nothing to indicate it was set deliberately. Running the identical probe with this branch's The spurious empty overrides are gone, while the legitimate, non-default I copied
This is the proper fix for the forwarding behavior at its source. |
getCurrentSettings()now skips a setting when all of the following hold:The existing compiled-default check used
($compiledDefaults[$value] ?? null) === $set, which cannot tell "absent" apart from "present and empty"; the new guard usesarray_key_exists()precisely for that distinction.This is deliberately narrower than the old blanket
$set === ''skip, so the empty/"off" override detection that 616034c added is preserved: an empty orOffvalue is still reported whenever there is evidence for it (the setting appears in an ini file, or in the compiled-in defaults).The guard only bows out when there is no evidence at all that an override happened, which is exactly the
apc.preload_pathcase, and more generally any ini setting of an extension that is invisible to thephp -nprobe.This is complementary to #98, not a replacement for it. #98 reads
builtin_default_valuefromini_get_all()in-process, but that relies on php/php-src#22134, which is still open againstmaster. Until that ships and users upgrade to a PHP version that has it, #98 falls back to the samephp -nchild-process probe.