Bug #80323 [Nab]: is_callable() not same to type "callable"
| From: | girgias@php.net | Date: | Fri, 06 Nov 2020 13:41:17 +0000 |
| Subject: | Bug #80323 [Nab]: is_callable() not same to type "callable" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-230164@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80323&edit=1
ID: 80323
Updated by: girgias@php.net
Reported by: antonfedonyuk at gmail dot com
Summary: is_callable() not same to type "callable"
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Any
PHP Version: 7.2.34
Block user comment: N
Private report: N
New Comment:
Again this is expected behaviour for PHP 7, so if you could stop trolling your self and wasting time
of maintainers that would be great.
Previous Comments:
------------------------------------------------------------------------
[2020-11-05 21:26:39] antonfedonyuk at gmail dot com
> girgias@php.net "If you try your last script in PHP 8"
we don't talk about any version, please stop trolling
------------------------------------------------------------------------
[2020-11-05 21:13:48] girgias@php.net
I'm having troubled understanding what you're going at, a deprecation warning is different
from an error.
If you try your last script in PHP 8, (were the deprecation was enacted) you get false and while
attempting to call it you'll get a Fatal Error: https://3v4l.org/ilbYM
Something which you don't get in PHP 7.x and thus it is callable, deprecated behaviour but
callable.
Same thing with your first example: https://3v4l.org/USs5U
------------------------------------------------------------------------
[2020-11-05 19:35:22] antonfedonyuk at gmail dot com
> levim@php.net how you test it?
that code still generate error (tested in php 7.x):
<?php
class Test {
public function callback() {}
}
class Test2 {
public function set(callable $callback) {}
}
$callback = 'Test::callback';
var_dump(is_callable($callback));
$a = new Test2();
$a->set($callback);
?>
------------------------------------------------------------------------
[2020-11-05 19:29:18] antonfedonyuk at gmail dot com
> levim@php.net "you are calling
Test::callback without an
> object and it is not marked as statiÑ"
Congratulations, devs find 2 new bugs!
Or you don't see any problem here? (:
------------------------------------------------------------------------
[2020-11-05 19:15:14] levim@php.net
The "new" bug isn't a bug at all; you are calling Test::callback without
an object and it is not marked as static. Can you provide a reproduction case for the first bug?
------------------------------------------------------------------------
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=80323
--
Edit this bug report at https://bugs.php.net/bug.php?id=80323&edit=1