#33732 [Com]: behavior of constants in class and interface extending
| From: | daniel dot gorski at develnet dot org | Date: | Sat, 29 Oct 2005 16:38:26 +0000 |
| Subject: | #33732 [Com]: behavior of constants in class and interface extending | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87206@lists.php.net to get a copy of this message | ||
ID: 33732
Comment by: daniel dot gorski at develnet dot org
Reported By: lukas dot starecek at centrum dot cz
Status: Open
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.0.3
New Comment:
This bug is _still_ contained in 5.1.0RC4.
regards dtg
Previous Comments:
------------------------------------------------------------------------
[2005-07-17 10:41:34] lukas dot starecek at centrum dot cz
Description:
------------
If interface define any constants, then it's not possible (due to
error) implement this interface in any class and extend any other class
with this interface.
Reproduce code:
---------------
interface iA {
const cA = 'const of iA';
}
class A implements iA {
}
class B extends A implements iA {
}
$b = new B();
echo iA::cA;
echo A::cA;
echo B::cA;
----- Another example -----
interface iA {
const cA = 'const of iA';
}
class A implements iA {
}
interface iB extends iA {
}
class B extends A implements iB {
}
$b = new B();
echo iA::cA;
echo A::cA;
echo iB::cA;
echo B::cA;
Expected result:
----------------
const of iA
const of iA
const of iA
----- Another example -----
const of iA
const of iA
const of iA
const of iA
Actual result:
--------------
Fatal error: Cannot inherit previously-inherited constant cA from
interface iA
----- Another example -----
Fatal error: Cannot inherit previously-inherited constant cA from
interface iB
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33732&edit=1