Edit report at https://bugs.php.net/bug.php?id=60573&edit=1

 ID:                 60573
 Comment by:         andries at centim dot be
 Reported by:        jpa...@php.net
 Summary:            type hinting with "self" keyword causes weird errors
 Status:             Closed
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   *nix
 PHP Version:        5.3.8
 Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

This patch seems to cause strange behaviour for interfaces. If the "self" 
keyword is defined in an interface, I would think that "self" would refer to 
the implementing class.

Test script which worked in 5.3.19:

<?php

interface Comparable
{
    function compare(self $compare);
}

// Which is then implemented:

class Foo implements Comparable
{
    function compare(self $compare)
    {}
}

class Bar implements Comparable
{
    function compare(self $compare)
    {}
}

$foo = new Foo();
$bar = new Bar();

$foo->compare($foo);
$bar->compare($bar);


Previous Comments:
------------------------------------------------------------------------
[2012-07-24 23:37:43] ras...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=d74a258f240e3d1dcb14ec086ba6fe48a4864dad
Log: Fixed Bug #60573 (type hinting with &quot;self&quot; keyword causes weird 
errors)

------------------------------------------------------------------------
[2012-07-24 23:37:02] ras...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=0b7f94545e95813b3d6392d92deead5b8bd022b8
Log: MFH: Fixed bug #60573 (type hinting with &quot;self&quot; keyword causes 
weird errors)

------------------------------------------------------------------------
[2012-04-18 09:46:34] larue...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=d74a258f240e3d1dcb14ec086ba6fe48a4864dad
Log: Fixed Bug #60573 (type hinting with &quot;self&quot; keyword causes weird 
errors)

------------------------------------------------------------------------
[2012-04-18 09:45:50] larue...@php.net

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=0b7f94545e95813b3d6392d92deead5b8bd022b8
Log: MFH: Fixed bug #60573 (type hinting with &quot;self&quot; keyword causes 
weird errors)

------------------------------------------------------------------------
[2012-03-02 03:32:33] larue...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.



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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=60573


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60573&edit=1

Reply via email to