Skip to content

Fix the timeout argument number in snmp3_set() errors - #25368

Open
lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/snmp3-set-timeout-argument-8.5
Open

lacatoire wants to merge 1 commit into
php:PHP-8.5from
lacatoire:fix/snmp3-set-timeout-argument-8.5

Conversation

@lacatoire

@lacatoire lacatoire commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

snmp3_set() names the wrong argument when $timeout or $retries is invalid: $timeout is argument 11 and $retries argument 12, but the errors cite 10 and 11.

To reproduce

$oid = '.1.3.6.1.2.1.1.5.0';
foreach ([[-2, 1], [100, -2]] as [$timeout, $retries]) {
    try {
        snmp3_set('127.0.0.1', 'user', 'noAuthNoPriv', '', '', '', '', $oid, 's', 'x', $timeout, $retries);
    } catch (Throwable $e) {
        echo $e::class, ': ', $e->getMessage(), "\n";
    }
}

Before (8.5.12):

ValueError: snmp3_set(): Argument #10 ($value) must be between -1 and 9223372036854775807
ValueError: snmp3_set(): Argument #11 ($timeout) must be between -1 and 2147483647

After:

ValueError: snmp3_set(): Argument #11 ($timeout) must be between -1 and 9223372036854775807
ValueError: snmp3_set(): Argument #12 ($retries) must be between -1 and 2147483647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant