diff options
author | Zak Greant <zak@php.net> | 2001-12-30 09:36:24 +0000 |
---|---|---|
committer | Zak Greant <zak@php.net> | 2001-12-30 09:36:24 +0000 |
commit | 2f6ffb545e625f98ba0102212d968dbf2871277c (patch) | |
tree | 0f72c9237b40219655b3664b6733dd1321702a19 | |
parent | 427019cc764ab667d22ad28a33859f99e2d7a0cd (diff) | |
download | php-git-2f6ffb545e625f98ba0102212d968dbf2871277c.tar.gz |
Converted getenv to use zend_parse_parameters
-rw-r--r-- | ext/standard/basic_functions.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 5d637198e7..3ad80bac4b 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1178,21 +1178,15 @@ PHP_FUNCTION(long2ip) Get the value of an environment variable */ PHP_FUNCTION(getenv) { - pval **str; - char *ptr; + char *ptr, *str; + int str_len; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(str); - - if (Z_TYPE_PP(str) != IS_STRING) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { RETURN_FALSE; } - - ptr = sapi_getenv(Z_STRVAL_PP(str), Z_STRLEN_PP(str) TSRMLS_CC); - if (!ptr) { - ptr = getenv(Z_STRVAL_PP(str)); + ptr = sapi_getenv(str, str_len TSRMLS_CC); + if (! ptr) { + ptr = getenv(str); } if (ptr) { RETURN_STRING(ptr, 1); |