#49472 [NEW]: Constants defined in Interfaces can be overridden
From: phil at mossyvale dot co dot uk
Operating system: Mac OS X 10.5.8
PHP version: 5.3.0
PHP Bug Type: Class/Object related
Bug description: Constants defined in Interfaces can be overridden
Description:
------------
If an interface defines a constant and is then implemented by a class
which is then extended with a further class and both classes implement the
interface, the second class may override the interface constant without a
fatal error. Also present in 5.2.10 on FreeBSD 7.2
Reproduce code:
---------------
---
From manual page: language.oop5.interfaces
---
http://codepad.org/vStYX1Kz
Expected result:
----------------
Fatal error: Cannot inherit previously-inherited constant c from
interface ia ... on line 18
Actual result:
--------------
Program outputs "OceanSea" which indicates that the interface constant is
still available but the class constant with the same name overrides it.
--
Edit bug report at http://bugs.php.net/?id=49472&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49472&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49472&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49472&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49472&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49472&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49472&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49472&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49472&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49472&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49472&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49472&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49472&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49472&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49472&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49472&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49472&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49472&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49472&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49472&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49472&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49472&r=mysqlcfg
Thread (5 messages)
- phil at mossyvale dot co dot uk