]> granicus.if.org Git - php/commitdiff
Fixed bug #32427 (Interfaces are not allowed 'static' access modifier).
authorDmitry Stogov <dmitry@php.net>
Tue, 26 Apr 2005 08:48:23 +0000 (08:48 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 26 Apr 2005 08:48:23 +0000 (08:48 +0000)
NEWS
Zend/tests/bug32427.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 4cec0987a935cc45106e2327ba08ad3f6bbd71a5..2f2308c694e5e3d473233b82cf2ac924172a36bc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -111,6 +111,8 @@ PHP                                                                        NEWS
   (Uwe Schindler)
 - Fixed bug #32429 (method_exists() always return TRUE if __call method
   exists). (Dmitry)
+- Fixed bug #32427 (Interfaces are not allowed 'static' access modifier).
+  (Dmitry)
 - Fixed bug #32109 ($_POST is not populated in multithreaded environment).
   (Moriyoshi)
 - Fixed bug #31478 (segfault with empty() / isset()). (Moriyoshi)
diff --git a/Zend/tests/bug32427.phpt b/Zend/tests/bug32427.phpt
new file mode 100644 (file)
index 0000000..0a5cc4f
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Bug #32427 Interfaces are not allowed 'static' access modifier
+--FILE--
+<?php
+
+interface Example {
+       public static function sillyError();
+}
+
+class ExampleImpl implements Example {
+       public static function sillyError() {
+               echo "I am a silly error\n";
+       }
+}
+
+ExampleImpl::sillyError();
+?>
+--EXPECT--
+I am a silly error
index 41c0104979eacc0e50d59fbb2c418646c49afe9a..d3ee2c3f0234d08e96e9272ef0ae26da9de618e1 100644 (file)
@@ -1019,7 +1019,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
 
        if (is_method) {
                if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
-                       if (!(fn_flags_znode->u.constant.value.lval == ZEND_ACC_PUBLIC)) {
+                       if ((fn_flags_znode->u.constant.value.lval & ~(ZEND_ACC_STATIC|ZEND_ACC_PUBLIC))) {
                                zend_error(E_COMPILE_ERROR, "Access type for interface method %s::%s() must be omitted", CG(active_class_entry)->name, function_name->u.constant.value.str.val);
                        }
                        fn_flags_znode->u.constant.value.lval |= ZEND_ACC_ABSTRACT; /* propagates to the rest of the parser */