Commit e596efcdd77 for php
commit e596efcdd77788644848ca44133022a434ef519e
Author: Gina Peter Banyard <girgias@php.net>
Date: Sun Nov 22 20:06:10 2026 +0000
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.
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 3e2a66d85e7..4b79c808463 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 abfddd1f28e..40675011a2c 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 dc999c17dfa..d059bb11914 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 dfdfbeb56ef..4528ebb70bc 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 85a979829cf..b8d7f4576ac 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 7edfcf1da1f..7c8770aa88d 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 56096097620..31c4f85754e 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 4a81926aba5..0aa6a5456fa 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 dd468baa375..834f25ef0e0 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 6967c435890..410f45afdb6 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 aa616313207..0267c683913 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 37693660791..b71b6070ab8 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 aeb49e15ee1..ce8893b0445 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 253dab65398..a36c60dd348 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 \