From:             dcahh at gmx dot de
Operating system: XP Pro
PHP version:      5CVS-2004-04-26 (dev)
PHP Bug Type:     Class/Object related
Bug description:  Can't declare function protected in interface

Description:
------------
I can't have an abstract class provide it's functions protected to it's
child classes, since I'm able to declare only public functions within an
interface.

Reproduce code:
---------------
<?php

        interface AnyClassInterface {

                protected function doSomething ($sTest);

        }

        abstract class AnyClassAbstract {

                protected function doSomething ($sTest) {

                        echo $sTest;

                }

        }

        class AnyClass {

                public funtion __construct() {

                        $this->doSomething ('Hello World');

                }

        }

        $oAnyObject = new AnyClass();

?>

Expected result:
----------------
One should be able to declare a function in an interface to be protected,
so that classes extending the abstract class, which is implementing the
interface is able to provide it's functions only to child-classes and to
protect them from foreign classes.

Actual result:
--------------
Fatal error: Access type for interface method
AnyClassInterface::doSomething() must be omitted or declared public in
D:\apache-webroot\test\testphp\php5.php on line 5

-- 
Edit bug report at http://bugs.php.net/?id=28158&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28158&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28158&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28158&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28158&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28158&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28158&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28158&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28158&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28158&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28158&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28158&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28158&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28158&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28158&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28158&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28158&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28158&r=float

Reply via email to