Bug #78897 [Opn]: ReflectionMethod::getClosure declaration changed silently in 7.4
| From: | cmb@php.net | Date: | Mon, 02 Dec 2019 11:40:20 +0000 |
| Subject: | Bug #78897 [Opn]: ReflectionMethod::getClosure declaration changed silently in 7.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224007@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78897&edit=1
ID: 78897
Updated by: cmb@php.net
Reported by: dinchev dot dimitar at gmail dot com
Summary: ReflectionMethod::getClosure declaration changed
silently in 7.4
Status: Open
Type: Bug
Package: Reflection related
Operating System: Linux
PHP Version: 7.4.0
-Assigned To:
+Assigned To: nikita
Block user comment: N
Private report: N
New Comment:
This is caused by a fix[1] for static methods, which don't expect
an argument to be passed to ReflectionMethod::getClosure().
It seems to me that it's best to stick with this change, and to
document it.
Nikita, thoughts?
[1] <http://git.php.net/?p=php-src.git;a=commit;h=f085bddb51cf3ce4400f89447e40ddac66468f31>
Previous Comments:
------------------------------------------------------------------------
[2019-12-02 11:30:35] dinchev dot dimitar at gmail dot com
Description:
------------
Since upgrading to PHP 7.4, I get the following PHP Warning:
Declaration of Go\ParserReflection\ReflectionMethod::getClosure($object) should be compatible with
ReflectionMethod::getClosure($object = NULL)
The above framework class is extending ReflectionMethod and until 7.3.x the declaration of
ReflectionMethod::getClosure($object) apparently didn't have default null value, now making it
incompatible with the subclass declaration.
The change is not reflected in the release notes of PHP 7.4.0 or in the current documentation:
https://www.php.net/manual/en/reflectionmethod.getclosure.php
Test script:
---------------
<?php
class ReflectionMethodSubclass extends ReflectionMethod {
public function getClosure($object) {
return parent::getClosure($object);
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78897&edit=1