Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117637 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67964 invoked from network); 27 Apr 2022 14:55:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Apr 2022 14:55:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 361491804AB for ; Wed, 27 Apr 2022 09:30:58 -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,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-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 ; Wed, 27 Apr 2022 09:30:57 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id w19so4066422lfu.11 for ; Wed, 27 Apr 2022 09:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FY0HNrXjJSt9uEYTXJ9kQu1aYB+oVfyU6f4Gar1pf7Y=; b=XSbAqZKJyQ+z2Jk0eoT4KjEGF5DopDeN3Y2L1bzcHIwfOb31g7H+bS0T5p1f97r/eP dBhf+nqxBx/9c3L5Ye9e0nueOZOfQr6v2ZS5DGJbAkSBFPcdu6V9hY6Uytk0srxn5n9A iNkr5PN+FTC1W9R4bM4El0WEBjvH/jvQHaF9w= 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:cc; bh=FY0HNrXjJSt9uEYTXJ9kQu1aYB+oVfyU6f4Gar1pf7Y=; b=hLPZPrzbzOLVrJ4gQuFN8MW0K+qvrUDY3NlVQDA8BXMoEogKGO+PxuOPNICpaJGZGS yK7qe5tvoveEuHrb+r9Qzke0r/8S2AIrdD+o3yOmuOHKVS5Keo3s8x89lqzgUmU5vTgx wqmIhShjO7NwSUMnfdbjBQu9TeYyvveQvvQVZGtPHuDFEk75T9ZaF6dnrbcsuli9fq7F SyGQi4tjyj5gZoQ3Ei6BhndUE7GHp0Uoz4M8qMhl3xMk3QdtMdHiMsirHWKe2YO1G/4y 5FukLMuh1BmbTOumwVeZilKBA0klPDqwr3xjUvHyn9QG0dmClYau8xyGUe1YAfNYU2vp ZBOQ== X-Gm-Message-State: AOAM532SkLnHl+OEYFS4o9c1wynY8zIZFL6HGp6ndgcNiIvyiLI2XiK0 dZc1aPc03BQ3Y/NAHiNDE6Qvl0jy4ULGdiOYkogCpQ== X-Google-Smtp-Source: ABdhPJxf7i2OXcftkgJy15C0MrQX02a2Rz5GUHiPZPbq/7WKe9pYDY1Bm2dByULcrybnLwMCBxpPMdgEGvp7VLnmmZM= X-Received: by 2002:a05:6512:3301:b0:472:2373:eda9 with SMTP id k1-20020a056512330100b004722373eda9mr4555118lfe.455.1651077056017; Wed, 27 Apr 2022 09:30:56 -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: Wed, 27 Apr 2022 17:30:45 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000006bd08405dda555e3" Subject: Re: [PHP-DEV] NULL Coercion Consistency From: craig@craigfrancis.co.uk (Craig Francis) --0000000000006bd08405dda555e3 Content-Type: text/plain; charset="UTF-8" On Mon, 25 Apr 2022 at 23:18, Larry Garfield wrote: > > > 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. > > Just to note our off-list discussion, this is shown with: ``` function example($a) { var_dump(func_get_args()); } $a = example('A', 'B'); // Fine $b = strlen('A', 'B'); // Expects exactly 1 argument, 2 given ``` It's due to the old (pre-variadic) approach of using `func_get_args()`, `func_num_args()`, etc... https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list "It is also possible to achieve variable-length arguments by using func_num_args(), func_get_arg(), and func_get_args() functions. This technique is not recommended as it was used prior to the introduction of the ... token." I'd also note that using these functions (instead of "...$var") aren't so good for IDE's or Static Analysis, as the function signature does not clearly define the parameters exist (let alone type)... so these `func_*` functions might be candidates for deprecation, if anyone cares enough about them :-) Craig --0000000000006bd08405dda555e3--