Skip to content

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

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

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

@lacatoire

Copy link
Copy Markdown
Member Author

@devnexen

@devnexen devnexen left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible follow-up (if you didn't plan this already), in snmp_session_init() some arguments are hardcoded.

@devnexen devnexen closed this in 1a8b184 Nov 19, 2026
@lacatoire
lacatoire deleted the fix/snmp3-set-timeout-argument-8.5 branch November 19, 2026 13:26
@lacatoire

Copy link
Copy Markdown
Member Author

#25590

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.

3 participants