php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32427 Interfaces not allowed access modifiers
Submitted: 2005-03-23 13:27 UTC Modified: 2005-04-26 10:49 UTC
From: jason at amp-design dot net Assigned: andi (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-03-23 (dev) OS: Cent OS 3
Private report: No CVE-ID: None
 [2005-03-23 13:27 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-18 17:31 UTC] jason at amp-design dot net
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)
 [2005-04-26 10:49 UTC] dmitry@php.net
Fixed in CVS HEAD.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC