[php-src] master: main: move flock_compat files to main/ (#25345)
| From: | Gina Peter Banyard via GitHub | Date: | Sun, 22 Nov 2026 20:06:13 +0000 |
| Subject: | [php-src] master: main: move flock_compat files to main/ (#25345) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144045@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-11-22T20:06:10Z
Commit: https://github.com/php/php-src/commit/e596efcdd77788644848ca44133022a434ef519e
Raw diff: https://github.com/php/php-src/commit/e596efcdd77788644848ca44133022a434ef519e.diff
main: move flock_compat files to main/ (#25345)
Rather than have it in ext/standard.
As every other compatibility function that we reimplement resides in main/ and this also removes a
ext/standard dependency from main.
Changed paths:
A main/flock_compat.c
A main/flock_compat.h
D ext/standard/flock_compat.c
D ext/standard/flock_compat.h
M UPGRADING.INTERNALS
M configure.ac
M ext/dba/dba.c
M ext/session/mod_files.c
M ext/spl/spl_directory.c
M ext/standard/config.m4
M ext/standard/config.w32
M ext/standard/file.c
M ext/standard/streamsfuncs.c
M main/main.c
M main/streams/plain_wrapper.c
M main/streams/userspace.c
M win32/build/config.w32
Diff:
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 3e2a66d85e7b..4b79c8084631 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -47,6 +47,9 @@ PHP 8.7 INTERNALS UPGRADE NOTES
* stream_error_state
The motivation is to remove cyclic dependencies from PHP, as such it may be
possible to omit including ext/standard/file.h to access those globals.
+ . The flock_compat.h header has been moved from the ext/standard/ folder to
+ the main/ folder. The motivation for this change is to remove cyclic
+ dependencies from PHP.
- Removed:
. The ZEND_LOG_XOR() macro was removed.
diff --git a/configure.ac b/configure.ac
index abfddd1f28e4..40675011a2c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1654,6 +1654,7 @@ PHP_ADD_SOURCES([TSRM], m4_normalize([
PHP_ADD_SOURCES([main], m4_normalize([
explicit_bzero.c
+ flock_compat.c
fopen_wrappers.c
getopt.c
main.c
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index dc999c17dfa0..d059bb119142 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -30,7 +30,7 @@
#include "php_dba.h"
#include "ext/standard/info.h"
-#include "ext/standard/flock_compat.h" /* Compatibility for Windows */
+#include "main/flock_compat.h" /* Compatibility for Windows */
#include "php_gdbm.h"
#include "php_ndbm.h"
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index dfdfbeb56ef1..4528ebb70bcf 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -75,7 +75,7 @@
#include "php_session.h"
#include "mod_files.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#include "php_open_temporary_file.h"
#define FILE_PREFIX "sess_"
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 85a979829cfa..b8d7f4576ac3 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -19,7 +19,7 @@
#include "php.h"
#include "ext/standard/file.h"
#include "ext/standard/php_filestat.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#include "ext/standard/scanf.h"
#include "ext/standard/php_string.h" /* For php_basename() */
#include "zend_exceptions.h"
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 7edfcf1da1f5..7c8770aa88de 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -405,7 +405,6 @@ PHP_NEW_EXTENSION([standard], m4_normalize([
file.c
filestat.c
filters.c
- flock_compat.c
formatted_print.c
fsock.c
ftok.c
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index 56096097620d..31c4f85754eb 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -35,7 +35,7 @@ EXTENSION("standard", "array.c base64.c basic_functions.c
browscap.c \
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c password.c \
- streamsfuncs.c http.c flock_compat.c hrtime.c",
+ streamsfuncs.c http.c hrtime.c",
false /* never shared */);
ADD_SOURCES("ext/standard/libavifinfo", "avifinfo.c", "standard");
PHP_STANDARD = "yes";
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 4a81926aba51..0aa6a5456fae 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -20,7 +20,7 @@
/* {{{ includes */
#include "php.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#include "ext/standard/php_filestat.h"
#include "php_open_temporary_file.h"
#include "ext/standard/basic_functions.h"
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index dd468baa3754..834f25ef0e04 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -14,7 +14,7 @@
*/
#include "php.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#include "ext/standard/file.h"
#include "ext/standard/basic_functions.h"
#include "php_ini.h"
diff --git a/ext/standard/flock_compat.c b/main/flock_compat.c
similarity index 99%
rename from ext/standard/flock_compat.c
rename to main/flock_compat.c
index 6967c4358901..410f45afdb66 100644
--- a/ext/standard/flock_compat.c
+++ b/main/flock_compat.c
@@ -14,7 +14,7 @@
#include "php.h"
#include <errno.h>
-#include "ext/standard/flock_compat.h"
+#include "flock_compat.h"
#ifndef HAVE_FLOCK
PHPAPI int flock(int fd, int operation)
diff --git a/ext/standard/flock_compat.h b/main/flock_compat.h
similarity index 100%
rename from ext/standard/flock_compat.h
rename to main/flock_compat.h
diff --git a/main/main.c b/main/main.c
index aa6163132079..0267c6839137 100644
--- a/main/main.c
+++ b/main/main.c
@@ -60,7 +60,7 @@
#ifdef PHP_WIN32
#include <io.h>
#include "win32/php_registry.h"
-#include "ext/standard/flock_compat.h"
+#include "flock_compat.h"
#endif
#include "Zend/zend_builtin_functions.h"
#include "Zend/zend_exceptions.h"
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 376936607919..b71b6070ab88 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -17,7 +17,7 @@
#include "php_network.h"
#include "php_open_temporary_file.h"
#include "ext/standard/file.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#include "ext/standard/php_filestat.h"
#include <stddef.h>
#include <fcntl.h>
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index aeb49e15ee18..ce8893b04456 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -15,7 +15,7 @@
#include "php.h"
#include "php_globals.h"
-#include "ext/standard/flock_compat.h"
+#include "main/flock_compat.h"
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 253dab653986..a36c60dd348f 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -286,7 +286,7 @@ if (TARGET_ARCH == 'x64') {
ADD_FLAG("CFLAGS_BD_ZEND", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
-ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \
+ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c flock_compat.c
fopen_wrappers.c \
php_ini_builder.c php_glob.c \
php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
strlcat.c reentrancy.c php_variables.c php_ticks.c network.c \