Skip to content

Commit 9c59d22

Browse files
committed
Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked
I chose to check for the value of lock_file instead of checking the file_cache_only, because it is probably a little bit faster and we're going to access the lock_file variable anyway. It's also more generic. Closes GH-11341.
1 parent bce5360 commit 9c59d22

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ PHP NEWS
1515
- Opcache:
1616
. Fix allocation loop in zend_shared_alloc_startup(). (nielsdos)
1717
. Access violation on smm_shared_globals with ALLOC_FALLBACK. (KoudelkaB)
18+
. Fixed bug GH-11336 (php still tries to unlock the shared memory ZendSem
19+
with opcache.file_cache_only=1 but it was never locked). (nielsdos)
1820

1921
- SPL:
2022
. Fixed bug GH-11338 (SplFileInfo empty getBasename with more than one

ext/opcache/ZendAccelerator.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ static inline void accel_unlock_all(void)
354354
#ifdef ZEND_WIN32
355355
accel_deactivate_sub();
356356
#else
357+
if (lock_file == -1) {
358+
return;
359+
}
360+
357361
struct flock mem_usage_unlock_all;
358362

359363
mem_usage_unlock_all.l_type = F_UNLCK;

ext/opcache/zend_shared_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ zend_smm_shared_globals *smm_shared_globals;
5252
#ifdef ZTS
5353
static MUTEX_T zts_lock;
5454
#endif
55-
int lock_file;
55+
int lock_file = -1;
5656
static char lockfile_name[MAXPATHLEN];
5757
#endif
5858

0 commit comments

Comments
 (0)