Bug->Req #79824 [Opn]: Use late binding scope instead of scope in stack trace
| From: | nikic@php.net | Date: | Fri, 10 Jul 2020 12:11:35 +0000 |
| Subject: | Bug->Req #79824 [Opn]: Use late binding scope instead of scope in stack trace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227933@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79824&edit=1
ID: 79824
Updated by: nikic@php.net
Reported by: si dot schubert at live dot de
-Summary: static return type: message and stacktrace wrong for
Uncaught TypeError
+Summary: Use late binding scope instead of scope in stack
trace
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: *General Issues
Operating System: Debian GNU/Linux 10 (buster)
PHP Version: 8.0.0alpha2
Block user comment: N
Private report: N
New Comment:
This has no relation to the static return type. I'm also not convinced showing the LSB scope
instead of the scope makes sense.
Previous Comments:
------------------------------------------------------------------------
[2020-07-09 19:15:06] si dot schubert at live dot de
Description:
------------
the message and stack trace references the wrong class
Test script:
---------------
class A
{
public static function new(): static
{
return new self();
}
}
class B extends A
{
}
B::new();
Expected result:
----------------
Fatal error: Uncaught TypeError: B::new(): Return value must be of type B, A returned in
/app/bin/runner:8
Stack trace:
#0 /app/bin/runner(16): B::new()
#1 {main}
thrown in /app/bin/runner on line 8
Actual result:
--------------
Fatal error: Uncaught TypeError: A::new(): Return value must be of type B, A returned in
/app/bin/runner:8
Stack trace:
#0 /app/bin/runner(16): A::new()
#1 {main}
thrown in /app/bin/runner on line 8
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79824&edit=1