Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112400 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75237 invoked from network); 3 Dec 2020 21:38:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Dec 2020 21:38:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BA63A1804C3 for ; Thu, 3 Dec 2020 13:06:02 -0800 (PST) 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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (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 ; Thu, 3 Dec 2020 13:06:02 -0800 (PST) Received: by mail-io1-f51.google.com with SMTP id i18so3597882ioa.1 for ; Thu, 03 Dec 2020 13:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=enNJg65DZWChvanB+0Dv+VmMwPZQUA+X26fXn9whn7M=; b=UELf1Pv8/QpwU7oxa7+7I9M4D2aoy1kpB8KzOIKNjf5wDDt/L4wMB4IgTZzs6S4ibV eUcNyWESTb0Mqox74f17pV9T5luHSYSxc9GF9cZBEkUZocAYWWL3u8q0HJVEI2flTpl8 SAEYG2XdmTJqYDbvPA9oXnxBNH4zCXEQPmAP8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=enNJg65DZWChvanB+0Dv+VmMwPZQUA+X26fXn9whn7M=; b=d8gfqP+nTUGZ3w9uMbQ5DN1byjsyjNnw/qE8jnOxzLjSNKrQnthOEsmKvSfFk8w6q8 zzMWlh63e8ajdriF4liuU8Htmb2qFLY0jQr54q4NABPxDxcYv4vUi3gfkdZ1DzKd0nGh T4vEuYjoG3hczaSRD5rKl/acW+hkHqrawsKgCG5PZ+plkvVQ7v+/ry9uhyu8bhYIaz49 j0zAJX/xBLTVNN4RWfHe1HKbKA+YOs5h0QfVNG4mvOZMuHjBhwWnr2QjTayqk/3GkSyV F0UL6brbeX51qlDUjOkGlcwNmJZH4AwSLrrC1qVFPivoRBHsIGP/9Fb8pHwx2ecDHWNo KrYg== X-Gm-Message-State: AOAM532UL1KIAG+855NzGHJCBSzcfeXcEe3c6zW9PghaXSzEd6CIuIfm NU9FYYflpLMHzIgaXZJDy1PCOX7hvlgK/fYrvsmAqg== X-Google-Smtp-Source: ABdhPJzMQuwHjuPSm9ok+Tt5nLbD+eBaSX6eF2SQlYU9pOjm7FEpgXXwJ9qJppx92vFGOdk0uB7oL2PvDrjPZ/dm2YA= X-Received: by 2002:a5d:9d42:: with SMTP id k2mr1426517iok.151.1607029561367; Thu, 03 Dec 2020 13:06:01 -0800 (PST) MIME-Version: 1.0 References: <34FA3E20-9D06-4D08-937E-4216FEF35504@gmail.com> <7E98C687-7A24-49E7-A14C-3D68B4B3419E@gmail.com> In-Reply-To: <7E98C687-7A24-49E7-A14C-3D68B4B3419E@gmail.com> Reply-To: Levi Morrison Date: Thu, 3 Dec 2020 14:05:50 -0700 Message-ID: To: Claude Pache Cc: PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Missing warning for stat(), etc. when invoked with empty string From: internals@lists.php.net ("Levi Morrison via internals") On Thu, Dec 3, 2020 at 6:30 AM Claude Pache wrote: > > [Of course, I meant `stat()`, not `stats()`. Resending the message with c= orrect spelling, including in subject line. Sorry.] > > > Hi, > > `stat()` and friends invoked with empty string or null as argument, retur= n `false` (indicating failure), but do not emit the Warning that is expecte= d on failure. See: https://3v4l.org/jXC2N > > That discrepancy between the two ways of indicating failure is problemati= c. Indeed, whenever I use one of those functions without prefixing it by @,= I expect that it will either return a value of expected type (`array` in c= ase of `stat()`), or run the panic procedure of my error handler. > > I propose to ensure that those functions always emit a Warning in each an= d every situation they return false/null (provided, of course, that those f= unctions are not supposed to return `false/null` in absence of failure, and= that their purpose is not to check for failure condition as in `file_exist= s()`). > > =E2=80=94Claude > This is a long-standing behavior. Further, I don't know many people who want _more_ warnings in their codebase. In other words, I disagree with this proposal.