Skip to content

Commit 5c8604d

Browse files
Use zend_string API for mail.cr_lf_mode validation
1 parent ae7def7 commit 5c8604d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

main/main.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,11 @@ static PHP_INI_MH(OnUpdateMailLog)
725725
static PHP_INI_MH(OnUpdateMailCrLfMode)
726726
{
727727
if (new_value) {
728-
const char *val = ZSTR_VAL(new_value);
729728
if (ZSTR_LEN(new_value) > 0 &&
730-
strcmp(val, "crlf") != 0 &&
731-
strcmp(val, "lf") != 0 &&
732-
strcmp(val, "mixed") != 0 &&
733-
strcmp(val, "os") != 0) {
729+
!zend_string_equals_literal(new_value, "crlf") &&
730+
!zend_string_equals_literal(new_value, "lf") &&
731+
!zend_string_equals_literal(new_value, "mixed") &&
732+
!zend_string_equals_literal(new_value, "os")) {
734733
int err_type;
735734

736735
if (stage == ZEND_INI_STAGE_RUNTIME) {
@@ -740,7 +739,7 @@ static PHP_INI_MH(OnUpdateMailCrLfMode)
740739
}
741740

742741
if (stage != ZEND_INI_STAGE_DEACTIVATE) {
743-
php_error_docref(NULL, err_type, "Invalid value \"%s\" for mail.cr_lf_mode. Must be one of: \"crlf\", \"lf\", \"mixed\", \"os\"", val);
742+
php_error_docref(NULL, err_type, "Invalid value \"%s\" for mail.cr_lf_mode. Must be one of: \"crlf\", \"lf\", \"mixed\", \"os\"", ZSTR_VAL(new_value));
744743
}
745744

746745
return FAILURE;

0 commit comments

Comments
 (0)