Bug #81573 [NEW]: Invalid fatal error regarding mixed return type compatibility
| From: | azjezz at protonmail dot com | Date: | Sat, 30 Oct 2021 16:02:34 +0000 |
| Subject: | Bug #81573 [NEW]: Invalid fatal error regarding mixed return type compatibility | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237436@lists.php.net to get a copy of this message | ||
From: azjezz at protonmail dot com
Operating system: N/A
PHP version: 7.4.25
Package: Compile Failure
Bug Type: Bug
Bug description:Invalid fatal error regarding mixed return type compatibility
Description:
------------
This bug occurs on PHP 7.4, 8.0, and 8.1-dev.
when the return type of a method is changed in a sub-class from
mixed
to T and T is undefined, you get a fatal error.
This shouldn't result in any type of error as T is a sub-type of
mixed.
reference: https://github.com/revoltphp/event-loop/pull/15/files
Test script:
---------------
<?php
class A {
public function foo(): mixed { exit(0); }
}
class B extends A {
public function foo(): C { exit(0); }
}
Expected result:
----------------
no errors.
Actual result:
--------------
Fatal error: Could not check compatibility between B::foo(): C and
A::foo(): mixed, because class C is not available in /in/k7Jmq on line 8
--
Edit bug report at https://bugs.php.net/bug.php?id=81573&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81573&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81573&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81573&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81573&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81573&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81573&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81573&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81573&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81573&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81573&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81573&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81573&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81573&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81573&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81573&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81573&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81573&r=mysqlcfg