#33732 [Com]: behavior of constants in class and interface extending

From: Date: Mon, 07 Nov 2005 23:40:11 +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-87813@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: Is there any chance to fix this before 5.1? Zend is going enterprise I've heard ... Please take a look at this issue. I really can not imagine that this is very hard to implement. Thank you. Previous Comments: ------------------------------------------------------------------------ [2005-10-29 18:38:25] daniel dot gorski at develnet dot org This bug is _still_ contained in 5.1.0RC4. regards dtg ------------------------------------------------------------------------ [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

« previous php.bugs (#87813) next »