diff options
-rw-r--r-- | Zend/tests/inherit_internal_static.phpt | 18 | ||||
-rw-r--r-- | Zend/zend_object_handlers.c | 11 |
2 files changed, 21 insertions, 8 deletions
diff --git a/Zend/tests/inherit_internal_static.phpt b/Zend/tests/inherit_internal_static.phpt new file mode 100644 index 0000000000..4716717f15 --- /dev/null +++ b/Zend/tests/inherit_internal_static.phpt @@ -0,0 +1,18 @@ +--TEST-- +Inherit internal static property into userland class +--SKIPIF-- +<?php if (!extension_loaded('zend-test')) die('skip requires zend-test'); ?> +--FILE-- +<?php + +class Test extends _ZendTestClass { +} + +var_dump(Test::$_StaticProp); +_ZendTestClass::$_StaticProp = 42; +var_dump(Test::$_StaticProp); + +?> +--EXPECT-- +NULL +int(42) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index be967847dc..c883a878f0 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1406,14 +1406,14 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st } /* }}} */ -static void zend_intenal_class_init_statics(zend_class_entry *class_type) /* {{{ */ +ZEND_API void zend_class_init_statics(zend_class_entry *class_type) /* {{{ */ { int i; zval *p; if (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count) { if (class_type->parent) { - zend_intenal_class_init_statics(class_type->parent); + zend_class_init_statics(class_type->parent); } ZEND_MAP_PTR_SET(class_type->static_members_table, emalloc(sizeof(zval) * class_type->default_static_members_count)); @@ -1430,11 +1430,6 @@ static void zend_intenal_class_init_statics(zend_class_entry *class_type) /* {{{ } } /* }}} */ -ZEND_API void zend_class_init_statics(zend_class_entry *class_type) /* {{{ */ -{ - zend_intenal_class_init_statics(class_type); -} /* }}} */ - ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend_string *property_name, int type, zend_property_info **property_info_ptr) /* {{{ */ { zval *ret; @@ -1476,7 +1471,7 @@ ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend /* check if static properties were destroyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { if (ce->type == ZEND_INTERNAL_CLASS || (ce->ce_flags & ZEND_ACC_IMMUTABLE)) { - zend_intenal_class_init_statics(ce); + zend_class_init_statics(ce); } else { undeclared_property: if (type != BP_VAR_IS) { |