Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112340 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83939 invoked from network); 1 Dec 2020 18:26:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Dec 2020 18:26:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 621071804C4 for ; Tue, 1 Dec 2020 09:54:25 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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, 1 Dec 2020 09:54:25 -0800 (PST) Received: by mail-ot1-f53.google.com with SMTP id z23so2476325oti.13 for ; Tue, 01 Dec 2020 09:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t1ZD6fSV/DbxHx4/0rLUDB2CWXcz+C3mGeuxSedIpsI=; b=B5cXmAEIPykaPPaS1aVtWgCQVQiiVRgfzWsfsh8LyYqod+4ijmNyG71g+ApIFBJuIo 7imSntlNclSdI+7lAVDlzmGY5A2ZLg8NWq+WAZQp9MmDlzytwKFbUVsN+yVPplHe+M4T UxXQh1yJz1klFl0ximLwqNDgj3eleUiqWJihyvek4J3S0iPcVgBW+uTWhBG6JfjUDdHr nnaNak7ymDeGF3b8N/DWiTE8Gmqbk06RtUll8QyyEJeoBzZljtNI0M73EsIAwY9XcYew MXSuH6rBVoIiT6HWmGJ+/9M/AJ+uGe5Uu20U6Cw4nz5qR/KpL/u+qXrsCLg9I1ai7RCN P2Rg== 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; bh=t1ZD6fSV/DbxHx4/0rLUDB2CWXcz+C3mGeuxSedIpsI=; b=Lbk21sy5YX6Cy54YcRsn3FqKn20/ZBsV/L6eWhaj/kh64il5wQuX9dVs/TkQRjGVIm WTJoX6IZ7Q5c8J901MFZAZH0LDm8aJ25KIxz8hDTjQ+rM3r1qFQcrxzen5725qQCw6WI mqNYbmBj3gKYB0S9yZAE7wzIzFOZ7o9p0sIdTqgFftBl1Jxk/iubUsKPRd6OiLeV2IKQ N2CsyDBKmF89A0Akk2Hgrh2EX/xNt1lxBQJZDUc8Mz8I6HfPa5GgRdGgBjHwzmz1DrpH DB0BTcuSUuOo1VmzktfOleh4kGImMB8K44bEFHY726oc9ExwRB3yh4XdcOLV1IZ7X2Ob Gq9Q== X-Gm-Message-State: AOAM531QTqDGBugZpmNezmpKzexBxb2OrPeCbbqoDR51+Nb7NcHuo7Bc b/xi5PND/OmP/lVC+HfA7wBc02DKUihbcCA5fQ== X-Google-Smtp-Source: ABdhPJyQlUgbOa2PeA/3ksdj2ROq3SeWC8xmUhrMdTJWzWnBIprZnKORR9gfV0RCQRwboj9/B2swc+hhreaOGTKhr/8= X-Received: by 2002:a9d:7517:: with SMTP id r23mr2620909otk.146.1606845264294; Tue, 01 Dec 2020 09:54:24 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 1 Dec 2020 09:54:11 -0800 Message-ID: To: "G. P. B." Cc: "Christoph M. Becker" , "Aimeos | Norbert Sendetzky" , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: PHP 8 is_file/is_dir input handling From: paul.crovella@gmail.com (Paul Crovella) On Tue, Dec 1, 2020 at 9:48 AM G. P. B. wrote: > > > On Tue, 1 Dec 2020 at 17:46, G. P. B. wrote: >> >> On Tue, 1 Dec 2020 at 17:45, Paul Crovella wrote: >>> >>> On Tue, Dec 1, 2020 at 9:25 AM Christoph M. Becker wrote: >>> > >>> > On 01.12.2020 at 18:18, Aimeos | Norbert Sendetzky wrote: >>> > >>> > > PHP 8 is stricter in checking input data then PHP 7. This is good but >>> > > has some side effects for is_file(), is_dir() and similar functions when >>> > > invalid paths are passed for checking. >>> > > >>> > > In PHP 7, this returns FALSE: >>> > > >>> > > php -r 'var_dump(is_file("ab\0c"));' >>> > > >>> > > In PHP 8, the same code throws a ValueException. Problem is now that >>> > > it's not possible to check upfront if the passed argument is a valid >>> > > path to avoid the exception being thrown. >>> > >>> > This is only about the NUL byte in the filename. You can easily check >>> > for that yourself. :) >>> > >>> > Regards, >>> > Christoph >>> >>> Or is_file could check for it, handle it gracefully, and be a safe >>> function to call without worrying about this undocumented edge case. >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: https://www.php.net/unsub.php >>> >> > > Apologize my email client sent by mistake: > But this has always generated a warning see: > https://3v4l.org/7E2mv > > So this is not new behaviour. > > George P. Banyard The result is in fact new. An uncaught ValueError isn't a warning.