From 91ff8d67e771ee4c0fd3d5dd04e23eaaba381247 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 3 Sep 2003 19:28:46 +0000 Subject: [PATCH] Cannot turn a static property into a non static one and vice versa --- Zend/zend_compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 07cab637fb..30d215232c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1750,6 +1750,12 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro } if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { + if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) { + zend_error(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s", + (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->arKey, + (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->arKey); + + } if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) { zend_error(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) { -- 2.40.0