mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
if (child_info->flags & ZEND_ACC_STATIC) {
- zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
+ zval **prop;
+ if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
+ (*prop)->refcount++;
+ zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
+ zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
+ }
} else {
zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1);
}
}
+static void inherit_sttaic_prop(zval **p)
+{
+ (*p)->refcount++;
+ (*p)->is_ref = 1;
+}
+
+
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
{
if ((ce->ce_flags & ZEND_ACC_INTERFACE)
/* Inherit properties */
zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
+ zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) inherit_sttaic_prop, NULL, sizeof(zval *), 0);
zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
- /* STATIC_MEMBERS_FIXME */
-/* zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); */
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
zend_hash_merge_ex(&ce->function_table, &parent_ce->function_table, (copy_ctor_func_t) do_inherit_method, sizeof(zend_function), (merge_checker_func_t) do_inherit_method_check, ce);
do_inherit_parent_constructor(ce);
zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name);
}
- while (tmp_ce) {
- if (zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval)==SUCCESS) {
- break;
- }
- tmp_ce = tmp_ce->parent;
- }
+ zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval);
if (!retval) {
if (silent) {
}
}
- zval_update_constant(retval, (void *) 1 TSRMLS_CC);
return retval;
}