Bug #70957 [Asn->Csd]: self::class can not be resolved with reflection for abstract class

From: Date: Mon, 23 Nov 2015 04:41:04 +0000
Subject: Bug #70957 [Asn->Csd]: self::class can not be resolved with reflection for abstract class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197375@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70957&edit=1

 ID:                 70957
 Updated by:         laruence@php.net
 Reported by:        lisachenko dot it at gmail dot com
 Summary:            self::class can not be resolved with reflection for
                     abstract class
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Reflection related
 PHP Version:        5.6.15
 Assigned To:        laruence
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ab17840d33354cc32d24c88d3e401d7b0869c996
Log: Fixed bug #70957 (self::class can not be resolved with reflection for abstract class)


Previous Comments:
------------------------------------------------------------------------
[2015-11-23 03:47:28] laruence@php.net

actually, this is not only about refelction, see also:

<?php

abstract class Foo
{
    function bar($a = self::class) {}
}

trait T {
    public function bar() {
    }
}

class Bar extends Foo
{
    use T;
}

------------------------------------------------------------------------
[2015-11-22 19:34:42] lisachenko dot it at gmail dot com

Description:
------------
Can not export reflection method in the abstract class to the string value for method with default
parameter, equals to 'self::class'

See https://3v4l.org/3TdIg, reproduced in all latest 5.6
versions.

Test script:
---------------
<?php

abstract class Foo
{
    private function bar($a = self::class) {}
}


$refMethod = new \ReflectionMethod('Foo', 'bar');
echo "Exported: ", $refMethod;

Expected result:
----------------
Exported: Method [ <user> private method bar ] {
  @@ /in/3TdIg 5 - 5

  - Parameters [1] {
    Parameter #0 [ <optional> $a = 'Foo' ]
  }
}

Actual result:
--------------
Exported: 
Process exited with code 139.


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



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


Thread (3 messages)

« previous php.bugs (#197375) next »