Bug #80032 [NEW]: Can't use valid callback as default value for callable parameters
| From: | antonfedonyuk at gmail dot com | Date: | Fri, 28 Aug 2020 19:16:11 +0000 |
| Subject: | Bug #80032 [NEW]: Can't use valid callback as default value for callable parameters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228789@lists.php.net to get a copy of this message | ||
From: antonfedonyuk at gmail dot com
Operating system: Any
PHP version: 7.4.9
Package: Compile Failure
Bug Type: Bug
Bug description:Can't use valid callback as default value for callable parameters
Description:
------------
Can't use valid callback(string or array) as default value of callable
parameters. It's generate fatal error: Default value for parameters with
callable type can only be NULL. The guide doesn't contain any notes on
this issue.
Test script:
---------------
<?php
function test(callable $callback = 'strtoupper')
{
return $callback();
}
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=80032&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80032&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80032&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80032&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80032&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80032&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80032&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80032&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80032&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80032&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80032&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80032&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80032&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80032&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80032&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80032&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80032&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80032&r=mysqlcfg