Bug #70839 [Asn->Csd]: Convertion optional argument to variadic forbidden by LSP checks

From: Date: Thu, 23 Jan 2020 14:24:01 +0000
Subject: Bug #70839 [Asn->Csd]: Convertion optional argument to variadic forbidden by LSP checks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225069@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70839&edit=1 ID: 70839 Updated by: nikic@php.net Reported by: nikic@php.net Summary: Convertion optional argument to variadic forbidden by LSP checks -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 5.6.16 Assigned To: nikic Block user comment: N Private report: N New Comment: Fixed by https://github.com/php/php-src/pull/5059 in PHP 8.0. Previous Comments: ------------------------------------------------------------------------ [2015-11-02 17:04:36] nikic@php.net Actually this issue also exists in PHP 5.6 if you have more than one optional parameter: class Foo { public function test($foo = null, $bar = null) {} } class Baz extends Foo { public function test(...$args) {} } The fact that it worked for one was just an accident that PHP 7 fixed. We should allow changing any number of optional arguments to a variadic one in both 5.6 and 7.0. ------------------------------------------------------------------------ [2015-11-02 16:48:45] nikic@php.net Description: ------------ Should be allowed and was allowed in 5.6. Off by one error caused by the variadic parameter no longer counting as an argument. Test script: --------------- class Foo { public function test($bar = null) {} } class Baz extends Foo { public function test(...$args) {} } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70839&edit=1

« previous php.bugs (#225069) next »