IncrementalInflateEncodingMismatch
warning native on by default PHP ≥ 7.0Group: Probable bugs
Match the inflate encoding to the input.
Example
<?php
$c=inflate_init(ZLIB_ENCODING_RAW); inflate_add($c,gzencode("sample"));Reported:
- line 2: Match the inflate encoding to the input.
Detection
- Track a local/direct inflate_init context into inflate_add, comparing a direct/unchanged-local gzencode, gzcompress or gzdeflate output against its resolved encoding constant. Report proven mismatched gzip, zlib or raw formats. Explicit alternative encoder formats and transformed data remain unknown.
- Resolve builtin functions, extension classes, method receivers, constants and named arguments. Follow unchanged locals and aliases only within the same bounded lexical scope. Require a reachable path; merge branch facts only when all incoming paths establish them.
- Emit one finding at the violating operation, not one per evidence statement. Rebinding, writes, by-reference escape, unresolved calls that can mutate relevant state, and exhausted analysis budgets remove proof.
Exceptions (no report)
Exclude encoders with an explicit encoding argument, including named arguments that omit the level.
An encoder whose arguments include an unpacked list (gzencode($data, ...$options)) may receive an encoding the same way and is excluded too.
- Exclude shadowed builtins, unresolved receivers, incomplete syntax and unknown prerequisite facts. An extension function name alone does not prove an application function is that builtin.
- A dominating valid guard or repair described in Detection prevents the finding. Both legacy noinspection and custos-ignore forms suppress this ID.
Fix
No automatic fix. The required repair depends on error handling, data selection, lifecycle ordering or application policy.
All edits use exact byte ranges and preserve comments and evaluation order. Offer no fix when its stated prerequisites cannot be proven or the replacement is unsupported by the configured PHP version.
PHP versions
Requires PHP 7.0 or later and the referenced extension API. Respect method-specific introduction versions within PHP 5.3–8.5; unsupported optional APIs cannot establish facts. Named arguments require PHP 8.0 or later.
Configure
In custos.json:
{
"rules": {
"IncrementalInflateEncodingMismatch": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
// @custos-ignore IncrementalInflateEncodingMismatch