@@ -3616,6 +3616,16 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
3616
3616
}
3617
3617
/* }}} */
3618
3618
3619
+ static inline zend_string * zval_make_interned_string (zval * zv ) /* {{{ */
3620
+ {
3621
+ ZEND_ASSERT (Z_TYPE_P (zv ) == IS_STRING );
3622
+ Z_STR_P (zv ) = zend_new_interned_string (Z_STR_P (zv ));
3623
+ if (ZSTR_IS_INTERNED (Z_STR_P (zv ))) {
3624
+ Z_TYPE_FLAGS_P (zv ) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE );
3625
+ }
3626
+ return Z_STR_P (zv );
3627
+ }
3628
+
3619
3629
ZEND_API int zend_declare_property_ex (zend_class_entry * ce , zend_string * name , zval * property , int access_type , zend_string * doc_comment ) /* {{{ */
3620
3630
{
3621
3631
zend_property_info * property_info , * property_info_ptr ;
@@ -3632,6 +3642,10 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
3632
3642
}
3633
3643
}
3634
3644
3645
+ if (Z_TYPE_P (property ) == IS_STRING && !ZSTR_IS_INTERNED (Z_STR_P (property ))) {
3646
+ zval_make_interned_string (property );
3647
+ }
3648
+
3635
3649
if (!(access_type & ZEND_ACC_PPP_MASK )) {
3636
3650
access_type |= ZEND_ACC_PUBLIC ;
3637
3651
}
@@ -3774,6 +3788,10 @@ ZEND_API int zend_declare_class_constant_ex(zend_class_entry *ce, zend_string *n
3774
3788
"A class constant must not be called 'class'; it is reserved for class name fetching" );
3775
3789
}
3776
3790
3791
+ if (Z_TYPE_P (value ) == IS_STRING && !ZSTR_IS_INTERNED (Z_STR_P (value ))) {
3792
+ zval_make_interned_string (value );
3793
+ }
3794
+
3777
3795
if (ce -> type == ZEND_INTERNAL_CLASS ) {
3778
3796
c = pemalloc (sizeof (zend_class_constant ), 1 );
3779
3797
} else {
0 commit comments