Skip to content

ext/snmp: no need to use a smart_string for error message #19171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions ext/snmp/snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,21 +1038,18 @@ static bool snmp_session_set_auth_protocol(struct snmp_session *s, zend_string *
}
#endif

smart_string err = {0};

smart_string_appends(&err, "Authentication protocol must be \"SHA\"");
zend_value_error(
"Authentication protocol must be \"SHA\""
#ifdef HAVE_SNMP_SHA256
smart_string_appends(&err, " or \"SHA256\"");
" or \"SHA256\""
#endif
#ifdef HAVE_SNMP_SHA512
smart_string_appends(&err, " or \"SHA512\"");
" or \"SHA512\""
#endif
#ifndef DISABLE_MD5
smart_string_appends(&err, " or \"MD5\"");
" or \"MD5\""
#endif
smart_string_0(&err);
zend_value_error("%s", err.c);
smart_string_free(&err);
);
return false;
}
/* }}} */
Expand Down