#32427 [Asn]: Interfaces not allowed access modifiers
ID: 32427
User updated by: jason at amp-design dot net
Reported By: jason at amp-design dot net
Status: Assigned
Bug Type: Zend Engine 2 problem
Operating System: Cent OS 3
PHP Version: 5CVS-2005-03-23 (dev)
Assigned To: andi
New Comment:
It appears in the later CVS versions of PHP that this bug seems to have
gone. It appears to be fixed (maybe someone double check, and close it)
Previous Comments:
------------------------------------------------------------------------
[2005-03-30 18:51:12] tony2001@php.net
Assigning to Andi, as he's the author of this change:
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?php=69434a7f33b2b7d3cc6152f95b1a307f&r1=1.596&r2=1.597&ty=u
------------------------------------------------------------------------
[2005-03-23 13:27:27] jason at amp-design dot net
Description:
------------
In the 5.1.0 branch (this morning's build), there seems to be a problem
with interfaces and static methods.
If a method is declared as static, it raises an error.
Upon removing the public static keywords from the interface, I get an
error because the class implementing this interface has a different
signature / declaraton from the interface, Thus meaning static members
are a no-no with interfaces.
This was tested on this morning's snapshot build of 5.1.0. I assume
that this is a bug and not some daft change in behavoiour you want to
push into the 5.1.x branch of PHP as it would break a lot of existing
PHP5 code.
Reproduce code:
---------------
<?php
interface Example {
public static function sillyError();
}
class ExampleImpl implements Example {
public static function sillyError() {
echo 'I am a silly error';
}
}
ExampleImpl::sillyError();
?>
Expected result:
----------------
I am a silly error
Actual result:
--------------
Fatal error: Access type for interface method Example::sillyError()
must be omitted in /data/web/tools/iq_framework/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32427&edit=1
Thread (4 messages)