Bug #79925 [NEW]: Magic method __set_state signature check does not support covariance
| From: | ondrej at mirtes dot cz | Date: | Sun, 02 Aug 2020 21:35:54 +0000 |
| Subject: | Bug #79925 [NEW]: Magic method __set_state signature check does not support covariance | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228378@lists.php.net to get a copy of this message | ||
From: ondrej at mirtes dot cz
Operating system: All
PHP version: 8.0Git-2020-08-02 (Git)
Package: *General Issues
Bug Type: Bug
Bug description:Magic method __set_state signature check does not support covariance
Description:
------------
Magic methods from this RFC
https://wiki.php.net/rfc/magic-methods-signature
should support
covariance but don't. You should be able to narrow down a return type
but currently can't.
Test script:
---------------
<?php
class Foo
{
/**
* @param mixed[] $properties
* @return Type
*/
public static function __set_state(array $properties): self
{
return new self();
}
}
Expected result:
----------------
nothing
Actual result:
--------------
Fatal error: Foo::__set_state(): Return type must be object when
declared in...
--
Edit bug report at https://bugs.php.net/bug.php?id=79925&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79925&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79925&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79925&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79925&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79925&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79925&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79925&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79925&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79925&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79925&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79925&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79925&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79925&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79925&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79925&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79925&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79925&r=mysqlcfg