From: Zak Greant Date: Sun, 30 Dec 2001 10:13:08 +0000 (+0000) Subject: chdir: corrected proto, converted to zend_parse_parameters X-Git-Tag: PRE_ISSET_PATCH~356 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f01745896fe87c4ddd3ff12dd0bf8f229d5d1d3f;p=php chdir: corrected proto, converted to zend_parse_parameters --- diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 9d268972ee..e94e8b34f5 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -253,23 +253,22 @@ PHP_FUNCTION(chroot) /* }}} */ #endif -/* {{{ proto int chdir(string directory) +/* {{{ proto bool chdir(string directory) Change the current directory */ PHP_FUNCTION(chdir) { - pval **arg; - int ret; + char *str; + int ret, str_len; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + RETURN_FALSE; } - convert_to_string_ex(arg); - if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(arg), NULL, CHECKUID_ALLOW_ONLY_FILE)) { + if (PG(safe_mode) && !php_checkuid(str, NULL, CHECKUID_ALLOW_ONLY_FILE)) { RETURN_FALSE; } - ret = VCWD_CHDIR(Z_STRVAL_PP(arg)); + ret = VCWD_CHDIR(str); if (ret != 0) { php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno);