ImagickResizeStatusUsedAsImage
warning native on by defaultGroup: Probable bugs
Identify method/property access on unchanged result of resolved Imagick::resizeImage; it returns a boolean, not a replacement image.
Detection
- Report method/property access on unchanged result of resolved Imagick::resizeImage; it returns a boolean, not a replacement image.
- Resolve builtin functions, classes, constants and methods, including imports and supported named arguments. Follow only bounded local facts within one lexical scope. Receiver and argument provenance must establish the specific API contract; variable names and comments never prove intent.
- Report one finding per violating operation. A reachable path, unchanged value identity and applicable API behavior are required. Intervening mutation, unknown calls involving tracked values, escaped aliases or exhausted analysis budgets invalidate proof.
- D4. The accessed variable must still hold the boolean. Besides plain assignments, these make its value unknown, for the variable itself and for any variable it was copied from:
- a value rebind after the assignment that supplied the boolean and before the access: a
foreachkey or value target, an array orlist()destructuring target, acatchbinding, or passing the variable to a resolved call that binds an argument by reference (preg_match($pattern, $subject, $result)). When the access sits in a loop, a rebind anywhere in the outermost enclosing loop counts, since it reaches the access on a later iteration; - shared storage established anywhere before the access (or in an enclosing loop): a reference assignment taking the variable as its source (
$alias = &$result), aglobalorstaticdeclaration, or a by-reference closure capture.
- a value rebind after the assignment that supplied the boolean and before the access: a
Exceptions (no report)
- Exclude unresolved required symbols, user-defined lookalikes, incomplete syntax, unknown required values and unsupported versions.
- No report when D4 cannot establish that the variable still holds the boolean. A rebind that precedes the supplying assignment, follows the access outside any shared loop, or happens inside a nested function with a by-value capture does not prevent the report.
- Both
@custos-ignore ImagickResizeStatusUsedAsImageand@noinspection ImagickResizeStatusUsedAsImagesuppress this native rule.
Fix
None. A repair requires a semantic decision or application error-handling policy.
PHP versions
Available in PHP 5.3–8.5 where the referenced API exists. Do not apply extension contracts when the resolved API is unavailable. Gate syntax and version-specific behavior to the configured target.
Configure
In custos.json:
json
{
"rules": {
"ImagickResizeStatusUsedAsImage": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
php
// @custos-ignore ImagickResizeStatusUsedAsImage