Converted getenv to use zend_parse_parameters

This commit is contained in:
Zak Greant 2001-12-30 09:36:24 +00:00
parent 427019cc76
commit 2f6ffb545e

View file

@ -1178,21 +1178,15 @@ PHP_FUNCTION(long2ip)
Get the value of an environment variable */ Get the value of an environment variable */
PHP_FUNCTION(getenv) PHP_FUNCTION(getenv)
{ {
pval **str; char *ptr, *str;
char *ptr; int str_len;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string_ex(str);
if (Z_TYPE_PP(str) != IS_STRING) {
RETURN_FALSE; RETURN_FALSE;
} }
ptr = sapi_getenv(str, str_len TSRMLS_CC);
ptr = sapi_getenv(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC); if (! ptr) {
if (!ptr) { ptr = getenv(str);
ptr = getenv(Z_STRVAL_PP(str));
} }
if (ptr) { if (ptr) {
RETURN_STRING(ptr, 1); RETURN_STRING(ptr, 1);