Professional Web Applications Themes

#39403 [NEW]: A class can't implements interface implemented by implemented interface/classes - PHP Bugs

From: baldurien at bbnwn dot eu Operating system: Irrelevant PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug description: A class can't implements interface implemented by implemented interface/classes Description: ------------ Hi, Since php5.2, all my classes have error due to something that changed in php5.2 : Fatal error: Class XtfLexer cannot implement previously implemented interface XtfPrRegistrable The reason of that ? Well take a look at the classes (the code does not interest you as it's not the problem) interface XtfPrRegistrable {} interface XtfHeaderHandler extends XtfPrRegistrable {} class XtfLexer implements XtfHeaderHandler, XtfPrRegistrable {} Because the interface extends XtfPrRegistrable, the XtfLexer ...

  1. #1

    Default #39403 [NEW]: A class can't implements interface implemented by implemented interface/classes

    From: baldurien at bbnwn dot eu
    Operating system: Irrelevant
    PHP version: 5.2.0
    PHP Bug Type: Feature/Change Request
    Bug description: A class can't implements interface implemented by implemented interface/classes

    Description:
    ------------
    Hi,

    Since php5.2, all my classes have error due to something that changed in
    php5.2 :

    Fatal error: Class XtfLexer cannot implement previously implemented
    interface XtfPrRegistrable

    The reason of that ?

    Well take a look at the classes (the code does not interest you as it's
    not the problem)

    interface XtfPrRegistrable {}
    interface XtfHeaderHandler extends XtfPrRegistrable {}
    class XtfLexer implements XtfHeaderHandler, XtfPrRegistrable {}

    Because the interface extends XtfPrRegistrable, the XtfLexer can not
    implements XtfPrRegistrable itself.

    This is STUPID, REALLY STUPID.

    What happens if one day I change the interface/classes I
    implements/extends, and if I still wish to benefit from one interface that
    is *possibly* implemented by my parents interfaces/classes?

    Well : it will fails.

    Reproduce code:
    ---------------
    Try this :

    interface XtfPrRegistrable {}
    interface XtfHeaderHandler extends XtfPrRegistrable {}
    class XtfLexer implements XtfHeaderHandler, XtfPrRegistrable {}


    Expected result:
    ----------------
    We can implements interface implemented by parent class/interface, and no
    (fatal) error should be thrown.

    Actual result:
    --------------
    We can't.

    --
    Edit bug report at [url]http://bugs.php.net/?id=39403&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39403&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39403&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39403&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39403&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=39403&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=39403&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39403&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=39403&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=39403&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=39403&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=39403&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=39403&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=39403&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39403&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=39403&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=39403&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39403&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=39403&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39403&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39403&r=mysqlcfg[/url]
    baldurien at bbnwn dot eu Guest

  2. #2

    Default #39403 [Opn->Bgs]: A class can't implements interface implemented by implemented interface/classes

    ID: 39403
    Updated by: [email]tony2001php.net[/email]
    Reported By: baldurien at bbnwn dot eu
    -Status: Open
    +Status: Bogus
    Bug Type: Feature/Change Request
    Operating System: Irrelevant
    PHP Version: 5.2.0
    New Comment:

    That's right, you can't implement an interface twice, that just doesn't
    make any sense.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-11-06 16:48:20] baldurien at bbnwn dot eu

    Description:
    ------------
    Hi,

    Since php5.2, all my classes have error due to something that changed
    in php5.2 :

    Fatal error: Class XtfLexer cannot implement previously implemented
    interface XtfPrRegistrable

    The reason of that ?

    Well take a look at the classes (the code does not interest you as it's
    not the problem)

    interface XtfPrRegistrable {}
    interface XtfHeaderHandler extends XtfPrRegistrable {}
    class XtfLexer implements XtfHeaderHandler, XtfPrRegistrable {}

    Because the interface extends XtfPrRegistrable, the XtfLexer can
    not implements XtfPrRegistrable itself.

    This is STUPID, REALLY STUPID.

    What happens if one day I change the interface/classes I
    implements/extends, and if I still wish to benefit from one interface
    that is *possibly* implemented by my parents interfaces/classes?

    Well : it will fails.

    Reproduce code:
    ---------------
    Try this :

    interface XtfPrRegistrable {}
    interface XtfHeaderHandler extends XtfPrRegistrable {}
    class XtfLexer implements XtfHeaderHandler, XtfPrRegistrable {}


    Expected result:
    ----------------
    We can implements interface implemented by parent class/interface, and
    no (fatal) error should be thrown.

    Actual result:
    --------------
    We can't.


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39403&edit=1[/url]
    tony2001@php.net Guest

Similar Threads

  1. Replies: 2
    Last Post: December 25th, 02:35 PM
  2. Replies: 0
    Last Post: December 6th, 04:34 PM
  3. Replies: 1
    Last Post: November 21st, 08:32 AM
  4. Replies: 2
    Last Post: June 2nd, 07:40 AM
  5. Does Interface Size Matter? Is my interface too complex?
    By Foo Finder in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: July 15th, 12:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139