Skip to content

Commit 96ea59b

Browse files
committed
use Zend APIs
1 parent 6ede937 commit 96ea59b

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

ext/standard/basic_functions.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ PHP_FUNCTION(getenv)
696696

697697
ZEND_PARSE_PARAMETERS_START(0, 2)
698698
Z_PARAM_OPTIONAL
699-
Z_PARAM_STRING_OR_NULL(str, str_len)
699+
Z_PARAM_PATH_OR_NULL(str, str_len)
700700
Z_PARAM_BOOL(local_only)
701701
ZEND_PARSE_PARAMETERS_END();
702702

@@ -706,11 +706,6 @@ PHP_FUNCTION(getenv)
706706
return;
707707
}
708708

709-
if (UNEXPECTED(memchr(str, '\0', str_len) != NULL)) {
710-
zend_argument_value_error(1, "must not contain any null bytes");
711-
RETURN_THROWS();
712-
}
713-
714709
if (!local_only) {
715710
/* SAPI method returns an emalloc()'d string */
716711
char *ptr = sapi_getenv(str, str_len);
@@ -747,7 +742,7 @@ PHP_FUNCTION(putenv)
747742
Z_PARAM_STRING(setting, setting_len)
748743
ZEND_PARSE_PARAMETERS_END();
749744

750-
if (UNEXPECTED(memchr(setting, '\0', setting_len) != NULL)) {
745+
if (UNEXPECTED(zend_char_has_nul_byte(setting, setting_len))) {
751746
zend_argument_value_error(1, "must not contain any null bytes");
752747
RETURN_THROWS();
753748
}

0 commit comments

Comments
 (0)