mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
* Move glob to main/ from win32/ In preparation to make the Win32 reimplementation the standard cross-platform one. Currently, it doesn't do that and just passes through the original glob implementation. We could consider also having an option to use the standard glob for systems that have a sufficient one. * Enable building with win32 glob on non-windows Kind of broken. We're namespacing the function and struct, but not yet the GLOB_* defines. There are a lot of places callers check if i.e. NOMATCH is defined that would likely become redundant. Currently it also has php_glob and #defines glob php_glob (etc.) - I suspect doing the opposite and changing the callers would make more sense, just doing MVP to geet it to build (even if it fails tests). * Massive first pass at conversion to internal glob Have not tested yet. the big things are: - Should be invisible to userland PHP code. - A lot of :%s/GLOB_/PHP_GLOB_/g; the diff can be noisy as a result, especially in comments. - Prefixes everything with PHP_ to avoid conflicts with system glob in case it gets included transitively. - A lot of weird shared definitions that were sprawled out to other headers are now included in php_glob.h. - A lot of (but not yet all cases) of HAVE_GLOB are removed, since we can always fall back to php_glob. - Using the system glob is not wired up yet; it'll need more shim ifdefs for each flag type than just glob_t/glob/globfree defs. * Fix inclusion of GLOB_ONLYDIR This is a GNU extension, but we don't need to implement it, as the GNU implementation is flawed enough that callers have to manually filter it anyways; just provide a stub definition for the constant. We could consideer implementing this properly later. For now, fixes the basic glob constant tests. * Remove HAVE_GLOBs We now always have a glob implementation that works. HAVE_GLOB should only be used to check if we have a system implementation, for if we decide to wrap the system implementation instead. * We don't need to care about being POSIXly correct for internal glob * Check for reallocarray Ideally temporary until GH-17433. * Forgot to move this file from win32/ to main/ * Check for issetugid (BSD function) * Allow using the system glob with --enable-system-glob * Style fix after removing ifdef * Remove empty case for system glob
105 lines
1.8 KiB
PHP
105 lines
1.8 KiB
PHP
<?php
|
|
|
|
/** @generate-class-entries */
|
|
|
|
/**
|
|
* @var string
|
|
* @cvalue dirsep_str
|
|
*/
|
|
const DIRECTORY_SEPARATOR = UNKNOWN;
|
|
/**
|
|
* @var string
|
|
* @cvalue pathsep_str
|
|
*/
|
|
const PATH_SEPARATOR = UNKNOWN;
|
|
|
|
#if (defined(PHP_GLOB_BRACE) && PHP_GLOB_BRACE != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_BRACE
|
|
*/
|
|
const GLOB_BRACE = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_ERR) && PHP_GLOB_ERR != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_ERR
|
|
*/
|
|
const GLOB_ERR = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_MARK) && PHP_GLOB_MARK != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_MARK
|
|
*/
|
|
const GLOB_MARK = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_NOCHECK) && PHP_GLOB_NOCHECK != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_NOCHECK
|
|
*/
|
|
const GLOB_NOCHECK = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_NOESCAPE) && PHP_GLOB_NOESCAPE != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_NOESCAPE
|
|
*/
|
|
const GLOB_NOESCAPE = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_NOSORT) && PHP_GLOB_NOSORT != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_NOSORT
|
|
*/
|
|
const GLOB_NOSORT = UNKNOWN;
|
|
#endif
|
|
#if (defined(PHP_GLOB_ONLYDIR) && PHP_GLOB_ONLYDIR != 0)
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_ONLYDIR
|
|
*/
|
|
const GLOB_ONLYDIR = UNKNOWN;
|
|
#endif
|
|
#ifdef PHP_GLOB_AVAILABLE_FLAGS
|
|
/**
|
|
* @var int
|
|
* @cvalue PHP_GLOB_AVAILABLE_FLAGS
|
|
*/
|
|
const GLOB_AVAILABLE_FLAGS = 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;
|
|
|
|
/**
|
|
* @strict-properties
|
|
* @not-serializable
|
|
*/
|
|
final class Directory
|
|
{
|
|
public readonly string $path;
|
|
|
|
/** @var resource */
|
|
public readonly mixed $handle;
|
|
|
|
public function close(): void {}
|
|
|
|
public function rewind(): void {}
|
|
|
|
public function read(): string|false {}
|
|
}
|