SqliteBindingIndexZero
error native on by defaultGroup: Probable bugs
Start SQLite binding positions at one.
Example
php
<?php
function f(SQLite3Stmt $s) { $s->bindValue(0, 'ready'); }Reported:
- line 2: Start SQLite binding positions at one.
Detection
- Resolved SQLite3Stmt bindValue or bindParam receives constant integer zero as the parameter argument. String names and positive positions are excluded. A variable argument counts only while it provably still holds the literal zero it was assigned (see E3).
- Resolve builtin functions, extension classes, constants and method receivers, including aliases and supported named arguments. Inspect reachable operations in one lexical scope with bounded local flow.
- Emit one finding per violating operation. Never infer policy from names or comments. When the proof is inconclusive, nothing is reported.
Exceptions (no report)
- Exclude shadowed or unresolved symbols, incomplete code, unknown required constants, ambiguous receiver identity and unsupported versions. Reassignment, escaping aliases, and unknown calls invalidate dependent flow facts.
- Both @custos-ignore SqliteBindingIndexZero and @noinspection SqliteBindingIndexZero suppress this native rule.
- E3. A variable position is not a proven zero once the variable may have been stepped or rewritten behind the assignment: an increment or decrement (
$i++,++$i,$i--,--$i) or a closure capturing it by reference (use (&$i)) that appears before the call, or anywhere inside a loop that also contains the call. The same constructs placed after a call that no loop repeats do not affect it, and a by-value capture never does.
Fix
None. A safe repair requires choosing values, error handling, or application behavior.
PHP versions
Apply throughout PHP 5.3–8.5 only where the extension API and syntax exist. Do not flag API unavailability through this rule.
Options
None. Use normal rule configuration to enable or disable the inspection.
Configure
In custos.json:
json
{
"rules": {
"SqliteBindingIndexZero": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
php
// @custos-ignore SqliteBindingIndexZero