Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions ext/standard/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "php_string.h"
#include "php_scandir.h"
#include "basic_functions.h"
#include "dir_arginfo.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
Expand All @@ -44,6 +43,8 @@
#endif
#endif

#include "dir_arginfo.h"

typedef struct {
zend_resource *default_dir;
} php_dir_globals;
Expand Down Expand Up @@ -117,6 +118,8 @@ PHP_MINIT_FUNCTION(dir)
{
static char dirsep_str[2], pathsep_str[2];

register_dir_symbols(module_number);

dir_class_entry_ptr = register_class_Directory();

#ifdef ZTS
Expand All @@ -131,46 +134,30 @@ PHP_MINIT_FUNCTION(dir)
pathsep_str[1] = '\0';
REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_PERSISTENT);

REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_PERSISTENT);

#ifdef HAVE_GLOB

#ifdef GLOB_BRACE
REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_PERSISTENT);
#else
#ifndef GLOB_BRACE
# define GLOB_BRACE 0
#endif

#ifdef GLOB_MARK
REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_PERSISTENT);
#else
# define GLOB_MARK 0
#ifndef GLOB_ERR
# define GLOB_ERR 0
#endif

#ifdef GLOB_NOSORT
REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_PERSISTENT);
#else
# define GLOB_NOSORT 0
#ifndef GLOB_MARK
# define GLOB_MARK 0
#endif

#ifdef GLOB_NOCHECK
REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_PERSISTENT);
#else
#ifndef GLOB_NOCHECK
# define GLOB_NOCHECK 0
#endif

#ifdef GLOB_NOESCAPE
REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_PERSISTENT);
#else
#ifndef GLOB_NOESCAPE
# define GLOB_NOESCAPE 0
#endif

#ifdef GLOB_ERR
REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_PERSISTENT);
#else
# define GLOB_ERR 0
#ifndef GLOB_NOSORT
# define GLOB_NOSORT 0
#endif

#ifndef GLOB_ONLYDIR
Expand Down
58 changes: 58 additions & 0 deletions ext/standard/dir.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,64 @@

/** @generate-class-entries */

#if (defined(HAVE_GLOB) && defined(GLOB_BRACE))
/**
* @var int
* @cvalue GLOB_BRACE
*/
const GLOB_BRACE = UNKNOWN;
#endif
#if (defined(HAVE_GLOB) && defined(GLOB_ERR))
/**
* @var int
* @cvalue GLOB_ERR
*/
const GLOB_ERR = UNKNOWN;
#endif
#if (defined(HAVE_GLOB) && defined(GLOB_MARK))
/**
* @var int
* @cvalue GLOB_MARK
*/
const GLOB_MARK = UNKNOWN;
#endif
#if (defined(HAVE_GLOB) && defined(GLOB_NOCHECK))
/**
* @var int
* @cvalue GLOB_NOCHECK
*/
const GLOB_NOCHECK = UNKNOWN;
#endif
#if (defined(HAVE_GLOB) && defined(GLOB_NOESCAPE))
/**
* @var int
* @cvalue GLOB_NOESCAPE
*/
const GLOB_NOESCAPE = UNKNOWN;
#endif
#if (defined(HAVE_GLOB) && defined(GLOB_NOSORT))
/**
* @var int
* @cvalue GLOB_NOSORT
*/
const GLOB_NOSORT = UNKNOWN;
#endif
/**
* @var int
* @cvalue PHP_SCANDIR_SORT_ASCENDING
*/
const SCANDIR_SORT_ASCENDING = UNKNOWN;
/**
* @var int
* @cvalue PHP_SCANDIR_SORT_DESCENDING
*/
const SCANDIR_SORT_DESCENDING = UNKNOWN;
/**
* @var int
* @cvalue PHP_SCANDIR_SORT_NONE
*/
const SCANDIR_SORT_NONE = UNKNOWN;

class Directory
{
public readonly string $path;
Expand Down
27 changes: 26 additions & 1 deletion ext/standard/dir_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.