]> granicus.if.org Git - php/commitdiff
Cannot turn a static property into a non static one and vice versa
authorMarcus Boerger <helly@php.net>
Wed, 3 Sep 2003 19:28:46 +0000 (19:28 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 3 Sep 2003 19:28:46 +0000 (19:28 +0000)
Zend/zend_compile.c

index 07cab637fb2162bc77486f9dd4e49ddef010793a..30d215232c835cba6180b7799490b3cd1f0f29b5 100644 (file)
@@ -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) {