Bug->Doc #80032 [Opn->Ver]: Can't use valid callback as default value for callable parameters

From: Date: Fri, 28 Aug 2020 21:01:00 +0000
Subject: Bug->Doc #80032 [Opn->Ver]: Can't use valid callback as default value for callable parameters
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17835@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80032&edit=1 ID: 80032 Updated by: requinix@php.net Reported by: antonfedonyuk at gmail dot com Summary: Can't use valid callback as default value for callable parameters -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Package: Compile Failure +Package: *General Issues Operating System: Any PHP Version: 7.4.9 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2020-08-28 19:16:11] antonfedonyuk at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80032&edit=1

« previous php.doc.bugs (#17835) next »