Bug #75853 [Opn->Asn]: Unexpected fatal error invoking static method as callables

From: Date: Thu, 02 Sep 2021 13:26:40 +0000
Subject: Bug #75853 [Opn->Asn]: Unexpected fatal error invoking static method as callables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236383@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75853&edit=1 ID: 75853 Updated by: nikic@php.net Reported by: marcospassos dot com at gmail dot com Summary: Unexpected fatal error invoking static method as callables -Status: Open +Status: Assigned Type: Bug Package: Class/Object related PHP Version: 7.2.2RC1 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: https://wiki.php.net/rfc/deprecate_partially_supported_callables would resolve this inconsistency by dropping support. Previous Comments: ------------------------------------------------------------------------ [2018-01-22 15:06:31] cmb@php.net Also note that not only parent:: is_callable() , but actually any parent class of the class designated by the first array element. E.g. <https://3v4l.org/QULq6>. In my opionion that's rather dubious, but we may not be able to change this for BC reasons. ------------------------------------------------------------------------ [2018-01-22 00:46:05] marcospassos dot com at gmail dot com From manual: http://php.net/manual/en/language.types.callable.php // Type 5: Relative static class method call (As of PHP 5.3.0) class A { public static function who() { echo "A\n"; } } class B extends A { public static function who() { echo "B\n"; } } call_user_func(array('B', 'parent::who')); // A ------------------------------------------------------------------------ [2018-01-22 00:40:43] danack@php.net > which is a perfectly valid form of callable. Other than, "it kind of works some of the time", what's the justification for saying that it's a valid form of callable? i.e. is it in the manual anywhere? ------------------------------------------------------------------------ [2018-01-21 22:25:33] marcospassos dot com at gmail dot com I can't see any real use case for this. However, my point is that type-hinting against a callable should ensure that the argument is a function/method, so there is a problem in the pseudo-type checking mechanism indeed. ------------------------------------------------------------------------ [2018-01-21 19:37:57] levim@php.net This is one of the times I'm want to see some rationale as to why the bug is with callable and not with everything else. You are statically using child's symbol but statically referring to the parent method? If it was dynamic there *might* be a use-case for that but at least directly as written I don't see the value. Is there some use I'm missing? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=75853 -- Edit this bug report at https://bugs.php.net/bug.php?id=75853&edit=1

« previous php.bugs (#236383) next »