Skip to content

Commit 01e3415

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix access to uninitialized variables in preload_load()
2 parents 1570ce9 + 27807fd commit 01e3415

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
. Fixed bug GH-19817 (Decode SCRIPT_FILENAME issue in php 8.5).
1111
(Jakub Zelenka)
1212

13+
- Opcache:
14+
. Fixed bug GH-20081 (access to uninitialized vars in preload_load()).
15+
(Arnaud)
16+
1317
- SPL:
1418
. Fixed bug GH-20101 (SplHeap/SplPriorityQueue serialization
1519
exposes INDIRECTs). (nielsdos)

ext/opcache/ZendAccelerator.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4522,16 +4522,6 @@ static void preload_load(size_t orig_map_ptr_static_last)
45224522
}
45234523
}
45244524

4525-
if (EG(zend_constants)) {
4526-
EG(persistent_constants_count) = EG(zend_constants)->nNumUsed;
4527-
}
4528-
if (EG(function_table)) {
4529-
EG(persistent_functions_count) = EG(function_table)->nNumUsed;
4530-
}
4531-
if (EG(class_table)) {
4532-
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
4533-
}
4534-
45354525
size_t old_map_ptr_last = CG(map_ptr_last);
45364526
if (zend_map_ptr_static_last != ZCSG(map_ptr_static_last) || old_map_ptr_last != ZCSG(map_ptr_last)) {
45374527
CG(map_ptr_last) = ZCSG(map_ptr_last);
@@ -4801,6 +4791,12 @@ static zend_result accel_preload(const char *config, bool in_child)
48014791

48024792
preload_load(orig_map_ptr_static_last);
48034793

4794+
/* Update persistent counts, as shutdown will discard anything past
4795+
* that, and these tables are aliases to global ones at this point. */
4796+
EG(persistent_functions_count) = EG(function_table)->nNumUsed;
4797+
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
4798+
EG(persistent_constants_count) = EG(zend_constants)->nNumUsed;
4799+
48044800
/* Store individual scripts with unlinked classes */
48054801
HANDLE_BLOCK_INTERRUPTIONS();
48064802
SHM_UNPROTECT();

0 commit comments

Comments
 (0)