File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ PHP NEWS
17
17
. Fix crash when calling childNodes next() when iterator is exhausted.
18
18
(nielsdos)
19
19
20
+ - Opcache:
21
+ . Fixed bug GH-14109 (Fix accidental persisting of internal class constant in
22
+ shm). (ilutov)
23
+
20
24
- XML:
21
25
. Fixed bug GH-14124 (Segmentation fault with XML extension under certain
22
26
memory limit). (nielsdos)
Original file line number Diff line number Diff line change @@ -802,12 +802,17 @@ static zend_property_info *zend_persist_property_info(zend_property_info *prop)
802
802
803
803
static void zend_persist_class_constant (zval * zv )
804
804
{
805
- zend_class_constant * c = zend_shared_alloc_get_xlat_entry (Z_PTR_P (zv ));
805
+ zend_class_constant * orig_c = Z_PTR_P (zv );
806
+ zend_class_constant * c = zend_shared_alloc_get_xlat_entry (orig_c );
806
807
zend_class_entry * ce ;
807
808
808
809
if (c ) {
809
810
Z_PTR_P (zv ) = c ;
810
811
return ;
812
+ } else if (((orig_c -> ce -> ce_flags & ZEND_ACC_IMMUTABLE ) && !(Z_CONSTANT_FLAGS (orig_c -> value ) & CONST_OWNED ))
813
+ || orig_c -> ce -> type == ZEND_INTERNAL_CLASS ) {
814
+ /* Class constant comes from a different file in shm or internal class, keep existing pointer. */
815
+ return ;
811
816
} else if (!ZCG (current_persistent_script )-> corrupted
812
817
&& zend_accel_in_shm (Z_PTR_P (zv ))) {
813
818
return ;
Original file line number Diff line number Diff line change 26
26
#include "zend_shared_alloc.h"
27
27
#include "zend_operators.h"
28
28
#include "zend_attributes.h"
29
+ #include "zend_constants.h"
29
30
30
31
#define ADD_DUP_SIZE (m ,s ) ZCG(current_persistent_script)->size += zend_shared_memdup_size((void*)m, s)
31
32
#define ADD_SIZE (m ) ZCG(current_persistent_script)->size += ZEND_ALIGNED_SIZE(m)
@@ -386,6 +387,11 @@ static void zend_persist_class_constant_calc(zval *zv)
386
387
zend_class_constant * c = Z_PTR_P (zv );
387
388
388
389
if (!zend_shared_alloc_get_xlat_entry (c )) {
390
+ if (((c -> ce -> ce_flags & ZEND_ACC_IMMUTABLE ) && !(Z_CONSTANT_FLAGS (c -> value ) & CONST_OWNED ))
391
+ || c -> ce -> type == ZEND_INTERNAL_CLASS ) {
392
+ /* Class constant comes from a different file in shm or internal class, keep existing pointer. */
393
+ return ;
394
+ }
389
395
if (!ZCG (current_persistent_script )-> corrupted
390
396
&& zend_accel_in_shm (Z_PTR_P (zv ))) {
391
397
return ;
You can’t perform that action at this time.
0 commit comments