From:             lukas dot starecek at centrum dot cz
Operating system: Linux
PHP version:      5.0.3
PHP Bug Type:     Feature/Change Request
Bug description:  behavior of constants in class and interface extending

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 bug report at http://bugs.php.net/?id=33732&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33732&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33732&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33732&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33732&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33732&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33732&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33732&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33732&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33732&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33732&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33732&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33732&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33732&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33732&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33732&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33732&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33732&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33732&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33732&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33732&r=mysqlcfg

Reply via email to