From:             
Operating system: *nix
PHP version:      5.3.8
Package:          Scripting Engine problem
Bug Type:         Feature/Change Request
Bug description:type hinting with "self" keyword causes weird errors

Description:
------------
"self" should be thought as "the class where the keyword is written in".

Here is then a strange behavior using inheritance :

Test script:
---------------
class Foo {

public function setSelf(self $s) { }

}

class Bar extends Foo {

public function setSelf(self $s) { }

}


Expected result:
----------------
Strict Standards as Bar::setself() signature doesn't respect Foo::setSelf()

signature.
Foo's one has a type hint on Foo (using self keyword), but Bar's one on Bar

(still using self keyword) : the methods then have a signature mismatch,
and PHP 
should complain about that

Actual result:
--------------
Nothing happens.

Trying this gives the correct E_STRICT error, correct behavior :

class Foo {

public function setSelf(Foo $s) { }

}

class Bar extends Foo {

public function setSelf(Bar $s) { }

}


-- 
Edit bug report at https://bugs.php.net/bug.php?id=60573&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60573&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60573&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60573&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60573&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60573&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60573&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60573&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60573&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60573&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60573&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60573&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60573&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60573&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60573&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60573&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60573&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60573&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60573&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60573&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60573&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60573&r=mysqlcfg

Reply via email to