43#define DIRG(v) ZEND_TSRMG(dir_globals_id, php_dir_globals *, v)
46#define DIRG(v) (dir_globals.v)
52#define Z_DIRECTORY_PATH_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
53#define Z_DIRECTORY_HANDLE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 1)
58 ZEND_PARSE_PARAMETERS_START(0, 1) \
60 Z_PARAM_RESOURCE_OR_NULL(id) \
61 ZEND_PARSE_PARAMETERS_END(); \
63 if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \
67 if (!DIRG(default_dir)) { \
68 zend_type_error("No resource supplied"); \
71 if ((dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \
76 ZEND_PARSE_PARAMETERS_NONE(); \
77 zval *handle_zv = Z_DIRECTORY_HANDLE_P(myself); \
78 if (Z_TYPE_P(handle_zv) != IS_RESOURCE) { \
79 zend_throw_error(NULL, "Unable to find my handle property"); \
82 if ((dirp = (php_stream *)zend_fetch_resource_ex(handle_zv, "Directory", php_file_le_stream())) == NULL) { \
90 if (
DIRG(default_dir)) {
115 register_dir_symbols(module_number);
117 dir_class_entry_ptr = register_class_Directory();
152 php_set_default_dir(dirp->
res);
196 if (
res ==
DIRG(default_dir)) {
197 php_set_default_dir(
NULL);
202#if defined(HAVE_CHROOT) && !defined(ZTS) && defined(ENABLE_CHROOT_FUNC)
256 zend_string_release(
BG(CurrentStatFile));
257 BG(CurrentStatFile) =
NULL;
260 zend_string_release(
BG(CurrentLStatFile));
261 BG(CurrentLStatFile) =
NULL;
278#elif defined(HAVE_GETWD)
338 char *pattern =
NULL;
344 bool basedir_limit = 0;
377 pattern = work_pattern;
412 if (
PG(open_basedir) && *
PG(open_basedir)) {
433 if (S_IFDIR != (
s.st_mode & S_IFMT)) {
492 for (i = 0; i <
n; i++) {
chroot(string $directory)
readdir($dir_handle=null)
scandir(string $directory, int $sorting_order=SCANDIR_SORT_ASCENDING, $context=null)
closedir($dir_handle=null)
opendir(string $directory, $context=null)
dirname(string $path, int $levels=1)
dir(string $directory, $context=null)
glob(string $pattern, int $flags=0)
rewinddir($dir_handle=null)
#define Z_DIRECTORY_PATH_P(zv)
php_dir_globals dir_globals
#define Z_DIRECTORY_HANDLE_P(zv)
const GLOB_AVAILABLE_FLAGS
memset(ptr, 0, type->size)
PHPAPI void php_clear_stat_cache(bool clear_realpath_cache, const char *filename, size_t filename_len)
PHPAPI int php_check_open_basedir(const char *path)
PHPAPI int php_check_open_basedir_ex(const char *path, int warn)
PHPAPI void globfree(glob_t *pglob)
foreach($dp as $el) foreach( $dp as $el) if( $pass2< 2) echo ""
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
#define PHP_MINIT_FUNCTION
#define PHP_RINIT_FUNCTION
#define PHP_SCANDIR_SORT_NONE
#define PHP_SCANDIR_SORT_ASCENDING
#define php_stream_context_from_zval(zcontext, nocontext)
struct _php_stream php_stream
struct _php_stream_context php_stream_context
struct _php_stream_dirent php_stream_dirent
#define php_stream_readdir(dirstream, dirent)
#define php_stream_auto_cleanup(stream)
#define php_stream_to_zval(stream, zval)
#define php_stream_opendir(path, options, context)
PHPAPI int php_stream_dirent_alphasort(const zend_string **a, const zend_string **b)
PHPAPI int php_stream_dirent_alphasortr(const zend_string **a, const zend_string **b)
#define PHP_STREAM_FLAG_IS_DIR
#define php_stream_scandir(dirname, namelist, context, compare)
#define php_stream_rewinddir(dirstream)
#define PHP_STREAM_FLAG_NO_FCLOSE
zend_resource * default_dir
#define INTERNAL_FUNCTION_PARAMETERS
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format,...)
ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str)
#define RETURN_STRINGL(s, l)
#define ZEND_PARSE_PARAMETERS_END()
#define ZEND_PARSE_PARAMETERS_NONE()
#define ZVAL_STRING(z, s)
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define Z_PARAM_LONG(dest)
#define Z_PARAM_PATH(dest, dest_len)
#define Z_PARAM_RESOURCE_OR_NULL(dest)
#define ZVAL_STRINGL(z, s, l)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert_new(HashTable *ht, zval *pData)
ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
ZEND_API zend_result ZEND_FASTCALL zend_list_delete(zend_resource *res)
ZEND_API void ZEND_FASTCALL zend_list_close(zend_resource *res)
struct _zend_string zend_string
#define ZEND_PATHS_SEPARATOR
struct _zend_class_entry zend_class_entry
#define Z_ARRVAL_P(zval_p)
struct _zend_resource zend_resource
#define IS_ABSOLUTE_PATH(path, len)
#define VCWD_GETCWD(buff, size)
#define VCWD_STAT(path, buff)