php-src/ext/ffi
Calvin Buckley 76791e90b9
Use win32 glob implementation on all platforms (#18164)
* 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
2025-05-20 16:20:59 -03:00
..
tests Merge branch 'PHP-8.4' 2025-02-17 10:27:47 +03:00
config.m4 Sync HAVE_<extension> help texts (#15167) 2024-08-02 01:41:47 +02:00
config.w32 Sync preprocessor macros help texts (#15218) 2024-08-04 12:52:16 +02:00
CREDITS
ffi.c Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
ffi.g Fix FFI Parsing of Pointer Declaration Lists (#17794) 2025-02-17 10:27:11 +03:00
ffi.stub.php Fix FFI prototypes (these functions can't return NULL) (#16075) 2024-09-26 20:19:46 +03:00
ffi_arginfo.h Fix FFI prototypes (these functions can't return NULL) (#16075) 2024-09-26 20:19:46 +03:00
ffi_parser.c Fix FFI Parsing of Pointer Declaration Lists (#17794) 2025-02-17 10:27:11 +03:00
php_ffi.h ext/ffi: Add const specifiers 2025-03-31 17:03:48 +01:00