summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--ext/opcache/ZendAccelerator.c17
2 files changed, 13 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index de126e54c3..cc68ef78b2 100644
--- a/NEWS
+++ b/NEWS
@@ -29,8 +29,9 @@ PHP NEWS
with more than 20 chars). (Nikita)
- Opcache:
- . Fixed #79114 (Eval class during preload causes class to be only half
+ . Fixed bug #79114 (Eval class during preload causes class to be only half
available). (Laruence)
+ . Fixed bug #79128 (Preloading segfaults if preload_user is used). (Nikita)
- OpenSSL:
. Fixed bug #79145 (openssl memory leak). (cmb, Nikita)
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 263336d99e..c7d73a999a 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -4200,19 +4200,24 @@ static zend_persistent_script* preload_script_in_shared_memory(zend_persistent_s
static void preload_load(void)
{
/* Load into process tables */
- if (zend_hash_num_elements(&ZCSG(preload_script)->script.function_table)) {
- Bucket *p = ZCSG(preload_script)->script.function_table.arData;
- Bucket *end = p + ZCSG(preload_script)->script.function_table.nNumUsed;
+ zend_script *script = &ZCSG(preload_script)->script;
+ if (zend_hash_num_elements(&script->function_table)) {
+ Bucket *p = script->function_table.arData;
+ Bucket *end = p + script->function_table.nNumUsed;
+ zend_hash_extend(CG(function_table),
+ CG(function_table)->nNumUsed + script->function_table.nNumUsed, 0);
for (; p != end; p++) {
_zend_hash_append_ptr_ex(CG(function_table), p->key, Z_PTR(p->val), 1);
}
}
- if (zend_hash_num_elements(&ZCSG(preload_script)->script.class_table)) {
- Bucket *p = ZCSG(preload_script)->script.class_table.arData;
- Bucket *end = p + ZCSG(preload_script)->script.class_table.nNumUsed;
+ if (zend_hash_num_elements(&script->class_table)) {
+ Bucket *p = script->class_table.arData;
+ Bucket *end = p + script->class_table.nNumUsed;
+ zend_hash_extend(CG(class_table),
+ CG(class_table)->nNumUsed + script->class_table.nNumUsed, 0);
for (; p != end; p++) {
_zend_hash_append_ex(CG(class_table), p->key, &p->val, 1);
}