Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_compile.c

From: Date: Sun, 08 Dec 2002 14:33:41 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_compile.c
References: 1 2  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-695@lists.php.net to get a copy of this message
At 08:30 08.12.2002, Zeev Suraski wrote:
Yep. If we decide that we don't want to allow that it's trivial to change, but off hand we don't see a problem with changing visibility (even though I have to admit I have a bad hunch about it, so we need to think about concrete examples and decide). Zeev
I guess the main problem is that you can circumvent restictions of class collections. Therefor i would vote for allowing only decreasing the visibility or force to keep it. Maybe this is a point were all developers should be asked in a RFC. I remeber there were a large discussion about OO and some people had good examples and explanations. Maybe this way a good well founded solution can be found. If you start such a RFC i would also like a RFC about final which i would appreciate very much (and it is easy and cheap). marcus
At 01:24 08/12/2002, Marcus Börger wrote:
Now you allow changing the visibility of methods from protected to public and such. Was this intended? marcus At 22:46 07.12.2002, Zeev Suraski wrote:
zeev            Sat Dec  7 16:46:13 2002 EDT
Modified files:
    /ZendEngine2        zend_compile.c
Log: Simplify/fix inheritance checks Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.330 ZendEngine2/zend_compile.c:1.331
--- ZendEngine2/zend_compile.c:1.330    Sat Dec  7 10:51:25 2002
+++ ZendEngine2/zend_compile.c Sat Dec 7 16:46:12 2002 @@ -1587,24 +1587,11 @@
                        zend_error(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
                }
        }
+
        /* Disallow making an inherited method abstract.
-       * Also check the visibility and copy it if needed. This must be done last
-       * since we may change the child flags here.
-       * Again first detect more than one error to make normal operation faster.
        */
-       if ((child_flags & (ZEND_FN_PPP_MASK|ZEND_ACC_ABSTRACT)) != (parent_flags & ZEND_FN_PPP_MASK)) {
-               if (child_flags & ZEND_ACC_ABSTRACT) {
-                       zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
-               }
-               if (!(child_flags & ZEND_FN_PPP_MASK) || (((child_flags|parent_flags) & ZEND_FN_PPP_MASK) == ZEND_ACC_PUBLIC)) {
-                       /* this is no error since we copy visibility here */
-                       /* child->common.fn_flags &= ~ZEND_FN_PPP_MASK; do not clear added public */
-                       child->common.fn_flags |= parent_flags & ZEND_FN_PPP_MASK;
-               } else {
-                       zend_error(E_COMPILE_ERROR, "Cannot redeclare %s %s::%s() as %s %s::%s()",
-                               zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), parent->common.function_name,
-                               zend_visibility_string(child_flags), ZEND_FN_SCOPE_NAME(child),  child->common.function_name);
-               }
+       if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
+               zend_error(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
        }
        return SUCCESS;
} -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#695) next »