ConflictingContentLengthHeaders
warning native on by defaultGroup: Probable bugs
Send one consistent Content-Length value.
Example
Finding:
php
<?php
header("Content-Length: 4"); header("Content-Length: 8", false);Reported:
- line 2: Send one consistent Content-Length value.
Detection
- Track header calls with constant Content-Length values and replacement flag. Report a call appending a different valid decimal value while an earlier effective Content-Length remains. Header names are case insensitive; trim optional whitespace. Numerically equal decimal lengths are consistent.
- Emit one finding per violating operation. Flow facts require a reachable path with no intervening mutation, escaped alias or unknown call involving the tracked value. When the proof is inconclusive, nothing is reported.
Exceptions (no report)
- Replacement calls, header_remove, equal values, unknown header values and branch-dependent state are excluded.
- Exclude shadowed builtin symbols, unresolved required types, incomplete syntax and unsupported PHP versions.
Fix
No automatic fix. Choosing a repair requires runtime information, error-handling policy or a semantic decision.
PHP versions
Available throughout PHP 5.3–8.5.
Configure
In custos.json:
json
{
"rules": {
"ConflictingContentLengthHeaders": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
php
// @custos-ignore ConflictingContentLengthHeaders