helly Sun Feb 19 11:55:11 2006 UTC Modified files: /ZendEngine2 zend_compile.c zend_API.c /php-src/tests/classes abstract_static.phpt Log: - Interfaces may have static methods to enforce their existance in implementing classes http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_compile.c?r1=1.680&r2=1.681&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.680 ZendEngine2/zend_compile.c:1.681 --- ZendEngine2/zend_compile.c:1.680 Sun Feb 19 11:42:30 2006 +++ ZendEngine2/zend_compile.c Sun Feb 19 11:55:11 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.680 2006/02/19 11:42:30 helly Exp $ */ +/* $Id: zend_compile.c,v 1.681 2006/02/19 11:55:11 helly Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1108,7 +1108,7 @@ } else { fn_flags = 0; } - if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT)) { + if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : "", is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.c?r1=1.341&r2=1.342&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.341 ZendEngine2/zend_API.c:1.342 --- ZendEngine2/zend_API.c:1.341 Sun Feb 19 11:42:30 2006 +++ ZendEngine2/zend_API.c Sun Feb 19 11:55:11 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.341 2006/02/19 11:42:30 helly Exp $ */ +/* $Id: zend_API.c,v 1.342 2006/02/19 11:55:11 helly Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2081,7 +2081,7 @@ scope->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } } - if (ptr->flags & ZEND_ACC_STATIC) { + if (ptr->flags & ZEND_ACC_STATIC && (!scope || (scope->ce_flags & ZEND_ACC_INTERFACE))) { zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name : "", scope ? "::" : "", ptr->fname); } } else { http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/abstract_static.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/tests/classes/abstract_static.phpt diff -u php-src/tests/classes/abstract_static.phpt:1.3 php-src/tests/classes/abstract_static.phpt:1.4 --- php-src/tests/classes/abstract_static.phpt:1.3 Sat Aug 9 14:48:47 2003 +++ php-src/tests/classes/abstract_static.phpt Sun Feb 19 11:55:11 2006 @@ -1,21 +1,29 @@ --TEST-- -ZE2 A static abstrcat method may not be called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +ZE2 A static abstrcat methods --FILE-- <?php -abstract class fail { - abstract static function show(); +interface showable +{ + static function show(); } -class pass extends fail { +class pass implements showable +{ static function show() { echo "Call to function show()\n"; } } pass::show(); + +eval(' +class fail +{ + abstract static function func(); +} +'); + fail::show(); echo "Done\n"; // shouldn't be displayed @@ -23,4 +31,4 @@ --EXPECTF-- Call to function show() -Fatal error: Cannot call abstract method fail::show() in %s on line %d +Fatal error: Static function fail::func() cannot be abstract in %s on line %d
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php