Hi Marcus,
Probably you are right.
I'll think a little bit, then probably will remove this patch.
Anybody have other ideas?
Is it allowed to define static method in interface?
<?php
interface Example {
public static function sillyError();
}
class ExampleImpl implements Example {
public static function sillyError() {
echo "I am a silly error\n";
}
}
ExampleImpl::sillyError();
?>
Thanks. Dmitry.
> -----Original Message-----
> From: Marcus Boerger [mailto:mail@xxxxxxxxxxxxxxxxx]
> Sent: Friday, April 29, 2005 9:44 PM
> To: Dmitry Stogov
> Cc: zend-engine-cvs@xxxxxxxxxxxxx
> Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 /
> zend_compile.c /tests bug32427.phpt php-src NEWS
>
>
> Hello Dmitry,
>
> like in the test this is 'SILLY' and also it is wrong!
> Static binding mean that the clas/interface has to have the
> code! Static function may never be abtract! If you allow
> static in interfaces then please let the interface have the
> function body, too. Otherwise just drop that pleae. It is
> just wrong now.
>
> Tuesday, April 26, 2005, 10:48:24 AM, you wrote:
>
> > dmitry Tue Apr 26 04:48:24 2005 EDT
>
> > Added files:
> > /ZendEngine2/tests bug32427.phpt
>
> > Modified files:
> > /php-src NEWS
> > /ZendEngine2 zend_compile.c
> > Log:
> > Fixed bug #32427 (Interfaces are not allowed 'static' access
> > modifier).
>
>
> > http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1882&r2=1.1883&ty=u
> > Index: php-src/NEWS
> > diff -u php-src/NEWS:1.1882 php-src/NEWS:1.1883
> > --- php-src/NEWS:1.1882 Tue Apr 26 04:47:27 2005
> > +++ php-src/NEWS Tue Apr 26 04:48:21 2005
> > @@ -111,6 +111,8 @@
> > (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)
> >
> http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.620&r2=1.6
> > 21&ty=u
> > Index: ZendEngine2/zend_compile.c
> > diff -u ZendEngine2/zend_compile.c:1.620
> ZendEngine2/zend_compile.c:1.621
> > --- ZendEngine2/zend_compile.c:1.620 Mon Apr 25 05:56:38 2005
> > +++ ZendEngine2/zend_compile.c Tue Apr 26 04:48:22 2005
> > @@ -17,7 +17,7 @@
> >
> >
> +-------------------------------------------------------------
> ---------+
> > */
>
> > -/* $Id: zend_compile.c,v 1.620 2005/04/25 09:56:38 dmitry Exp $ */
> > +/* $Id: zend_compile.c,v 1.621 2005/04/26 08:48:22 dmitry Exp $ */
>
> > #include <zend_language_parser.h>
> > #include "zend.h"
> > @@ -1019,7 +1019,7 @@
>
> > 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 */
>
> > http://cvs.php.net/co.php/ZendEngine2/tests/bug32427.phpt?r=1.1&p=1
> > Index: ZendEngine2/tests/bug32427.phpt
> > +++ ZendEngine2/tests/bug32427.phpt
> > --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
>
>
>
>
> --
> Best regards,
> Marcus mailto:mail@xxxxxxxxxxxxxxxxx
>
>
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|