Skip to content

Commit 96a1257

Browse files
committed
More edge case fixes that may cause bug #78106
1 parent 91a6cdb commit 96a1257

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ static zend_always_inline zend_string *accel_find_interned_string(zend_string *s
439439

440440
if (!ZCG(counted)) {
441441
if (!ZCG(accelerator_enabled) || accel_activate_add() == FAILURE) {
442-
return str;
442+
return NULL;
443443
}
444444
ZCG(counted) = 1;
445445
}
@@ -747,10 +747,9 @@ static void accel_use_shm_interned_strings(void)
747747
if (ZCSG(interned_strings).saved_top == NULL) {
748748
accel_copy_permanent_strings(accel_new_interned_string);
749749
} else {
750+
ZCG(counted) = 1;
750751
accel_copy_permanent_strings(accel_replace_string_by_shm_permanent);
751-
if (ZCG(counted)) {
752-
accel_deactivate_sub();
753-
}
752+
ZCG(counted) = 0;
754753
}
755754
accel_interned_strings_save_state();
756755

@@ -1177,7 +1176,11 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
11771176
cwd_len = ZCG(cwd_key_len) = buf + sizeof(buf) - 1 - res;
11781177
cwd = ZCG(cwd_key);
11791178
memcpy(ZCG(cwd_key), res, cwd_len + 1);
1179+
} else {
1180+
return NULL;
11801181
}
1182+
} else {
1183+
return NULL;
11811184
}
11821185
}
11831186
}
@@ -1216,7 +1219,11 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
12161219
include_path_len = ZCG(include_path_key_len) = buf + sizeof(buf) - 1 - res;
12171220
include_path = ZCG(include_path_key);
12181221
memcpy(ZCG(include_path_key), res, include_path_len + 1);
1222+
} else {
1223+
return NULL;
12191224
}
1225+
} else {
1226+
return NULL;
12201227
}
12211228
}
12221229
}
@@ -2290,6 +2297,7 @@ static void accel_reset_pcre_cache(void)
22902297
int accel_activate(INIT_FUNC_ARGS)
22912298
{
22922299
if (!ZCG(enabled) || !accel_startup_ok) {
2300+
ZCG(accelerator_enabled) = 0;
22932301
return SUCCESS;
22942302
}
22952303

@@ -2306,6 +2314,7 @@ int accel_activate(INIT_FUNC_ARGS)
23062314
ZCG(cwd_check) = 1;
23072315

23082316
if (file_cache_only) {
2317+
ZCG(accelerator_enabled) = 0;
23092318
return SUCCESS;
23102319
}
23112320

0 commit comments

Comments
 (0)