Re: Optional parameters without initializer
| From: | Stanislav Malyshev | Date: | Sat, 01 Dec 2018 01:48:46 +0000 |
| Subject: | Re: Optional parameters without initializer | ||
| References: | 1 2 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969387096@lists.php.net to get a copy of this message | ||
Hi!
> I know this doesn't answer your immediate question, but would it be
> worth seeing if these can be changed in the implementation itself, so
> that they *do* have a PHP-representable default? Since there is no
> "default" keyword, it sounds like a bug to have "no argument" mean
> something that cannot be represented by any valid input.
Some functions behave differently when you do not pass any argument than
when you pass an argument, even null. Changing it may lead to subtle BC
breaks in existing code - e.g. anonymous connection to a service and
connection with username/password set to empty string may be completely
different actions.
Even in PHP userland, not having a value (e.g. array key) is different
from any array key, and is not representable by any setting of the array
key.
--
Stas Malyshev
smalyshev@gmail.com