diff --git a/ext/opcache/tests/gh13433/ParentClass.inc b/ext/opcache/tests/gh13433/ParentClass.inc new file mode 100644 index 0000000000000..540f9f5d6f40c --- /dev/null +++ b/ext/opcache/tests/gh13433/ParentClass.inc @@ -0,0 +1,4 @@ + +--FILE-- +test()); +?> +OK +--EXPECT-- +object(TheClass)#1 (0) { +} +array(1) { + [0]=> + string(9) "non-empty" +} +OK diff --git a/ext/opcache/tests/gh13433/preload.inc b/ext/opcache/tests/gh13433/preload.inc new file mode 100644 index 0000000000000..d73773af1a7a4 --- /dev/null +++ b/ext/opcache/tests/gh13433/preload.inc @@ -0,0 +1,4 @@ +default_static_members_table = zend_shared_memdup_free(ce->default_static_members_table, sizeof(zval) * ce->default_static_members_count); /* Persist only static properties in this class. - * Static properties from parent classes will be handled in class_copy_ctor */ - i = (ce->parent && (ce->ce_flags & ZEND_ACC_LINKED)) ? ce->parent->default_static_members_count : 0; - for (; i < ce->default_static_members_count; i++) { - zend_persist_zval(&ce->default_static_members_table[i]); + * Static properties from parent classes will be handled in class_copy_ctor and are marked with IS_INDIRECT */ + for (i = 0; i < ce->default_static_members_count; i++) { + if (Z_TYPE(ce->default_static_members_table[i]) != IS_INDIRECT) { + zend_persist_zval(&ce->default_static_members_table[i]); + } } if (ce->ce_flags & ZEND_ACC_IMMUTABLE) { if (ce->ce_flags & ZEND_ACC_LINKED) {