]> granicus.if.org Git - php/commitdiff
chdir: corrected proto, converted to zend_parse_parameters
authorZak Greant <zak@php.net>
Sun, 30 Dec 2001 10:13:08 +0000 (10:13 +0000)
committerZak Greant <zak@php.net>
Sun, 30 Dec 2001 10:13:08 +0000 (10:13 +0000)
ext/standard/dir.c

index 9d268972eed85dbb429f751e28feda6c7903c7e2..e94e8b34f5af1973f496d16223063409445e170a 100644 (file)
@@ -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);