Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117624 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85272 invoked from network); 26 Apr 2022 15:01:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Apr 2022 15:01:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C578F180540 for ; Tue, 26 Apr 2022 09:36:25 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 26 Apr 2022 09:36:25 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id f38so33977604ybi.3 for ; Tue, 26 Apr 2022 09:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Fy+o1bIZLvChykOjzTicj5JYv1eNfMQv1XU3/JWysu4=; b=Mo95tHu1EvqZ7DXP6KEgbWz4PCh4Sjbieta0e75N8gwSLZ5GNSKUz3/khTTPF4XoAB eLaJu27HjknKRZXL/epgfYhiEQ1JcThJxHYpRcDeMZh3/MoMx3TsXhc84c2eTjRJjpv/ Q0H6ehPNtbZ12NLtMIP2P+dRoG4MFgWt5MISVnU6SE24Pwk2vhw5ytExuuDFd1E9us9K oEeVP0Yqapc5POAxPZjOnpGVNSFcoE5JRTENJZv67YbwleUEArQrt6jicK15A+vrEJLU K6lQnMIrlTg1Y3EPGeFcmgcjKWMcIUP6Ss62/Hr8JGcBL/9JWqheYSSQTxiiOOA8ca18 GGLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Fy+o1bIZLvChykOjzTicj5JYv1eNfMQv1XU3/JWysu4=; b=YRx75ZXQ79zCT1vOrZNBXcU3+Zjf2dQiDchU58wsqrdRomKMqDFo8PmJW5ogq0zCyK Wx2XoHf8oLDV4ob21MLh4mRMOYlDbjL6kuzCBu+A8qLE2htRJp0jpawbRA+hhrYYQed3 PfwcY8mcYQZ478sGn4roQp8/Z+ojoE5dkCo6nPxxwWwg/w8ZOY63Ou9VPHImD+gZnCyE /D+9oe4K41V2KRt3RSQUgLkjEWeQUqLPQh5EDI+3UVIPmOx+s7WZ0D8tjiiDPr5ioQb+ 8KVlUMtuHvoqd5U90E4xjP09ok3gzER/Vur3Qn9KztBRLlayAox25IhLmpyrbyXbWiCR PJsw== X-Gm-Message-State: AOAM533QAsp9+LW854/uAH5+EZxy9naSLnzQ4jVoBbLhWppxInm5XBFM kt3jEHtR/Dx70ayA8/loDlmKxHfHpQjoJ7+ZELC8TzSB/Q== X-Google-Smtp-Source: ABdhPJyAGx2AYXL8r9j5l7gNVUessDlHcpNEYaptU8aTb6yO+DVwof2OBAL2ZeU2AWAwNWEA6OoepmJLy0e7xncowHc= X-Received: by 2002:a25:4186:0:b0:648:3caf:2d43 with SMTP id o128-20020a254186000000b006483caf2d43mr14091160yba.156.1650990984660; Tue, 26 Apr 2022 09:36:24 -0700 (PDT) MIME-Version: 1.0 References: <42D0A480-F262-4F72-9C4D-887762A8D800@gmail.com> <0b061f28-a087-efd3-8602-424ee03458e0@gmail.com> <7DB0A01F-04FB-420D-9025-E027E5DE02F7@craigfrancis.co.uk> <19b2d192-fc4a-4122-8a01-54316a50fc1e@www.fastmail.com> In-Reply-To: <19b2d192-fc4a-4122-8a01-54316a50fc1e@www.fastmail.com> Date: Tue, 26 Apr 2022 18:36:14 +0200 Message-ID: To: php internals Content-Type: multipart/alternative; boundary="0000000000002b0d3b05dd914b16" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: guilliam.xavier@gmail.com (Guilliam Xavier) --0000000000002b0d3b05dd914b16 Content-Type: text/plain; charset="UTF-8" On Tue, Apr 26, 2022 at 12:18 AM Larry Garfield 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. > > > > 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. > > > 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 -- Guilliam Xavier --0000000000002b0d3b05dd914b16--