From:             bugs at php dot frankkleine dot de
Operating system: 
PHP version:      5.2.0
PHP Bug Type:     Unknown/Other Function
Bug description:  ReflectionParameter::getClass() throws exception for type 
hint self

Description:
------------
The ReflectionParameter::getClass() method does not work properly if the
reflected parameter uses "self" as type hint. Instead, a
ReflectionException is thrown saying that the class "self" does not exist.
Tested with 5.2 and 6.0.0-dev from Nov 22.

Reproduce code:
---------------
<?php
class stubParamTest
{
    function paramTest(self $param)
    {
        // nothing to do
    }
}
$test1 = new stubParamTest();
$test2 = new stubParamTest();
$test1->paramTest($test2);
$refParam = new ReflectionParameter(array('stubParamTest', 'paramTest'),
'param');
var_dump($refParam->getClass());
?>

Expected result:
----------------
object(ReflectionClass)[4]
  public 'name' => 'stubParamTest' (length=13)


Actual result:
--------------
Fatal error: Uncaught exception 'ReflectionException' with message 'Class
self does not exist' in
C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php:13
Stack trace: #0
C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php(13):
ReflectionParameter->getClass() #1 {main} thrown in
C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php on line
13

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

Reply via email to