diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index a2f9bc7f01c9..eae5457f7f23 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -52,6 +52,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES dependencies from PHP. - Removed: + . The HAVE_STRUCT_FLOCK configure macro was removed. . The ZEND_LOG_XOR() macro was removed. . The ZEND_TRUTH() macro was removed. . Removed zend_execute_scripts(). Manually call zend_execute_script() in a diff --git a/configure.ac b/configure.ac index 40675011a2c0..3779b90f79ce 100644 --- a/configure.ac +++ b/configure.ac @@ -456,7 +456,6 @@ AC_STRUCT_TIMEZONE PHP_MISSING_TIME_R_DECL -AC_CHECK_TYPES([struct flock],,,[#include ]) AC_CHECK_TYPES([socklen_t], [], [], [ #ifdef HAVE_SYS_TYPES_H # include diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 40be83d1ec62..fed78e686d0e 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -93,16 +93,9 @@ static int zend_file_cache_flock(int fd, int op) } return -1; } -#elif defined(HAVE_FLOCK) -# define zend_file_cache_flock flock #else -# define LOCK_SH 0 -# define LOCK_EX 1 -# define LOCK_UN 2 -static int zend_file_cache_flock(int fd, int type) -{ - return 0; -} +# include "main/flock_compat.h" +# define zend_file_cache_flock flock #endif #ifndef O_BINARY @@ -1157,6 +1150,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, bool in_shm) if (zend_file_cache_flock(fd, LOCK_EX) != 0) { close(fd); + zend_file_cache_unlink(filename); efree(filename); return FAILURE; } diff --git a/main/flock_compat.c b/main/flock_compat.c index 410f45afdb66..7b376d10e06e 100644 --- a/main/flock_compat.c +++ b/main/flock_compat.c @@ -24,7 +24,7 @@ PHPAPI int flock(int fd, int operation) #endif /* !defined(HAVE_FLOCK) */ PHPAPI int php_flock(int fd, int operation) -#ifdef HAVE_STRUCT_FLOCK /* {{{ */ +#ifndef PHP_WIN32 { struct flock flck; int ret; @@ -53,8 +53,7 @@ PHPAPI int php_flock(int fd, int operation) return ret; } -/* }}} */ -#elif defined(PHP_WIN32) /* {{{ */ +#else /* * Program: Unix compatibility routines * @@ -138,11 +137,4 @@ PHPAPI int php_flock(int fd, int operation) return -1; } -/* }}} */ -#else -#warning no proper flock support for your site -{ - errno = 0; - return 0; -} #endif diff --git a/main/flock_compat.h b/main/flock_compat.h index cfb6d82ba085..082c10d82487 100644 --- a/main/flock_compat.h +++ b/main/flock_compat.h @@ -15,15 +15,13 @@ #ifndef FLOCK_COMPAT_H #define FLOCK_COMPAT_H -#ifdef HAVE_STRUCT_FLOCK -#include -#include -#include -#endif - #ifdef PHP_WIN32 #include #include "config.w32.h" +#else +#include +#include +#include #endif /* php_flock internally uses fcntl whether or not flock is available