Re: NULL Coercion Consistency
| From: | Guilliam Xavier | Date: | Tue, 26 Apr 2022 16:36:14 +0000 |
| Subject: | Re: NULL Coercion Consistency | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117624@lists.php.net to get a copy of this message | ||
On Tue, Apr 26, 2022 at 12:18 AM Larry Garfield <larry@garfieldtech.com>
wrote:
> On Mon, Apr 25, 2022, at 4:07 PM, Rowan Tommins wrote:
>
> > Off the top of my head, I don't know what other inconsistencies remain,
> > but my point was that in every case so far, internal functions have been
> > adapted to match userland, not vice versa.
>
> <off topic>
>
> Internal functions error if you pass excessive arguments to a non-variadic
> function. User-space functions just ignore the extras. This is an
> inconsistency that has caused me considerable grief in the past year.
>
> I know Joe has said he wants userspace to become more strict like internal
> on this one. I will not predict what actually happens.
>
> </off topic>
>
<more>
A few internal functions have parameters with an
UNKNOWN default value in
the stubs, e.g.
https://github.com/php/php-src/blob/php-8.1.5/Zend/zend_builtin_functions.stub.php#L35
function get_class(object $object = UNKNOWN): string {}
documented with a question mark at
https://www.php.net/manual/en/function.get-class.php
get_class(object $object = ?): string
or
https://github.com/php/php-src/blob/php-8.1.5/ext/standard/basic_functions.stub.php#L1558
function mt_rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
documented with two signatures at
https://www.php.net/manual/en/function.mt-rand.php
mt_rand(): int
mt_rand(int $min, int $max): int
</more>
--
Guilliam Xavier