cvs: ZendEngine2 / zend_compile.c
| From: | Sterling Hughes | Date: | Sun, 20 Apr 2003 14:52:40 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1169@lists.php.net to get a copy of this message | ||
sterling Sun Apr 20 10:52:40 2003 EDT
Modified files:
/ZendEngine2 zend_compile.c
Log:
Add check for final properties
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.412 ZendEngine2/zend_compile.c:1.413
--- ZendEngine2/zend_compile.c:1.412 Fri Apr 11 13:30:41 2003
+++ ZendEngine2/zend_compile.c Sun Apr 20 10:52:40 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.412 2003/04/11 17:30:41 sebastian Exp $ */
+/* $Id: zend_compile.c,v 1.413 2003/04/20 14:52:40 sterling Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -1788,9 +1788,6 @@
}
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_FINAL) {
- zend_error(E_COMPILE_ERROR, "Cannot override final property %s::$%s",
parent_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) {
@@ -2346,6 +2343,11 @@
if (access_type & ZEND_ACC_ABSTRACT) {
zend_error(E_COMPILE_ERROR, "Properties cannot be declared abstract");
+ }
+
+ if (access_type & ZEND_ACC_FINAL) {
+ zend_error(E_COMPILE_ERROR, "Cannot declare property $%s::%s final, the final modifier is
allowed only for methods",
+ CG(active_class_entry)->name, var_name->u.constant.value.str.val);
}
if (!(access_type & ZEND_ACC_PPP_MASK)) {