FtpPendingTransferAcceptedAsComplete
warning native on by defaultGroup: Probable bugs
Identify boolean test of ftp_nb_get/put/fget/fput/continue in a branch returning true or emitting constant completion text. Require literal complete output or explicit success return; variable names cannot establish intent.
Detection
- Report boolean test of ftp_nb_get/put/fget/fput/continue in a branch returning true or emitting constant completion text. Require literal complete output or explicit success return; variable names cannot establish intent.
- The tested branch is the one that runs when the returned status is non-zero, so
FTP_MOREDATAreaches it: the body ofif (call), or theelseofif (!call). Parentheses, a plain assignment of the status,!and==/!=/===/!==against a boolean literal are followed with their polarity. The status is an integer, so a strict comparison of the status itself with a boolean has a fixed outcome:!==always holds (the body is the branch),===never does (theelseis). - 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.
Exceptions (no report)
- Exclude unresolved required symbols, user-defined lookalikes, incomplete syntax, unknown required values and unsupported versions.
- The branch that runs for a zero status only (
FTP_FAILED), such as the body ofif (!call)orif (call == false), is a failure path and is not reported whatever it returns. - A branch that refers to the global constant
FTP_FINISHEDanywhere outside nested functions and classes checks or drives the transfer to completion itself (a guard on the assigned status, a polling loop onftp_nb_continue); it is not reported. - Conditions of loops, compound or by-reference assignments, and comparisons with anything but a boolean literal are not followed. First-class callable syntax
ftp_nb_get(...)starts no transfer and is not reported. - Both
@custos-ignore FtpPendingTransferAcceptedAsCompleteand@noinspection FtpPendingTransferAcceptedAsCompletesuppress 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": {
"FtpPendingTransferAcceptedAsComplete": {
"enabled": false
}
}
}Suppress
Before the statement or declaration (or the first statement of the file):
php
// @custos-ignore FtpPendingTransferAcceptedAsComplete