diff options
author | Stanislav Malyshev <stas@php.net> | 2015-05-09 23:13:06 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2015-05-10 02:09:38 -0700 |
commit | be9b2a95adb504abd5acdc092d770444ad6f6854 (patch) | |
tree | 6a523d4042ef634a38022dad70357d0783bba977 /ext/standard/dir.c | |
parent | 4605d536d23b00813d11cc906bb48d39bdcf5f25 (diff) | |
download | php-git-be9b2a95adb504abd5acdc092d770444ad6f6854.tar.gz |
Fixed bug #69418 - more s->p fixes for filenames
Diffstat (limited to 'ext/standard/dir.c')
-rw-r--r-- | ext/standard/dir.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/ext/standard/dir.c b/ext/standard/dir.c index c64f37c2d6..27ffb9dbcb 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -93,8 +93,8 @@ static zend_class_entry *dir_class_entry_ptr; dirp = (php_stream *) zend_fetch_resource(&id TSRMLS_CC, -1, "Directory", NULL, 1, php_file_le_stream()); \ if (!dirp) \ RETURN_FALSE; \ - } - + } + /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0) ZEND_ARG_INFO(0, dir_handle) @@ -118,7 +118,7 @@ static void php_set_default_dir(int id TSRMLS_DC) if (id != -1) { zend_list_addref(id); } - + DIRG(default_dir) = id; } @@ -168,25 +168,25 @@ PHP_MINIT_FUNCTION(dir) #ifdef GLOB_NOSORT REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); -#else +#else # define GLOB_NOSORT 0 #endif #ifdef GLOB_NOCHECK REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); -#else +#else # define GLOB_NOCHECK 0 #endif #ifdef GLOB_NOESCAPE REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); -#else +#else # define GLOB_NOESCAPE 0 #endif #ifdef GLOB_ERR REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); -#else +#else # define GLOB_ERR 0 #endif @@ -219,12 +219,12 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) php_stream_context *context = NULL; php_stream *dirp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &dirname, &dir_len, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dirname, &dir_len, &zcontext) == FAILURE) { RETURN_NULL(); } context = php_stream_context_from_zval(zcontext, 0); - + dirp = php_stream_opendir(dirname, REPORT_ERRORS, context); if (dirp == NULL) { @@ -232,7 +232,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) } dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE; - + php_set_default_dir(dirp->rsrc_id TSRMLS_CC); if (createobject) { @@ -293,11 +293,11 @@ PHP_FUNCTION(chroot) { char *str; int ret, str_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { RETURN_FALSE; } - + ret = chroot(str); if (ret != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); @@ -305,9 +305,9 @@ PHP_FUNCTION(chroot) } php_clear_stat_cache(1, NULL, 0 TSRMLS_CC); - + ret = chdir("/"); - + if (ret != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); RETURN_FALSE; @@ -324,7 +324,7 @@ PHP_FUNCTION(chdir) { char *str; int ret, str_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -333,7 +333,7 @@ PHP_FUNCTION(chdir) RETURN_FALSE; } ret = VCWD_CHDIR(str); - + if (ret != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (errno %d)", strerror(errno), errno); RETURN_FALSE; @@ -358,7 +358,7 @@ PHP_FUNCTION(getcwd) { char path[MAXPATHLEN]; char *ret=NULL; - + if (zend_parse_parameters_none() == FAILURE) { return; } @@ -383,7 +383,7 @@ PHP_FUNCTION(rewinddir) { zval *id = NULL, **tmp, *myself; php_stream *dirp; - + FETCH_DIRP(); if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { @@ -450,9 +450,9 @@ PHP_FUNCTION(glob) RETURN_FALSE; } -#ifdef ZTS +#ifdef ZTS if (!IS_ABSOLUTE_PATH(pattern, pattern_len)) { - result = VCWD_GETCWD(cwd, MAXPATHLEN); + result = VCWD_GETCWD(cwd, MAXPATHLEN); if (!result) { cwd[0] = '\0'; } @@ -465,10 +465,10 @@ PHP_FUNCTION(glob) snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern); pattern = work_pattern; - } + } #endif - + memset(&globbuf, 0, sizeof(glob_t)); globbuf.gl_offs = 0; if (0 != (ret = glob(pattern, flags & GLOB_FLAGMASK, NULL, &globbuf))) { @@ -477,7 +477,7 @@ PHP_FUNCTION(glob) /* Some glob implementation simply return no data if no matches were found, others return the GLOB_NOMATCH error code. We don't want to treat GLOB_NOMATCH as an error condition - so that PHP glob() behaves the same on both types of + so that PHP glob() behaves the same on both types of implementations and so that 'foreach (glob() as ...' can be used for simple glob() calls without further error checking. @@ -517,11 +517,11 @@ no_results: } /* we need to do this everytime since GLOB_ONLYDIR does not guarantee that * all directories will be filtered. GNU libc documentation states the - * following: - * If the information about the type of the file is easily available - * non-directories will be rejected but no extra work will be done to - * determine the information for each file. I.e., the caller must still be - * able to filter directories out. + * following: + * If the information about the type of the file is easily available + * non-directories will be rejected but no extra work will be done to + * determine the information for each file. I.e., the caller must still be + * able to filter directories out. */ if (flags & GLOB_ONLYDIR) { struct stat s; @@ -545,7 +545,7 @@ no_results: } } /* }}} */ -#endif +#endif /* {{{ proto array scandir(string dir [, int sorting_order [, resource context]]) List files & directories inside the specified path */ @@ -583,7 +583,7 @@ PHP_FUNCTION(scandir) php_error_docref(NULL TSRMLS_CC, E_WARNING, "(errno %d): %s", errno, strerror(errno)); RETURN_FALSE; } - + array_init(return_value); for (i = 0; i < n; i++) { |