Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112337 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79643 invoked from network); 1 Dec 2020 18:18:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Dec 2020 18:18:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5917A1804D4 for ; Tue, 1 Dec 2020 09:45:35 -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-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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:45:31 -0800 (PST) Received: by mail-ot1-f47.google.com with SMTP id f16so2445336otl.11 for ; Tue, 01 Dec 2020 09:45:31 -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=ZvU8lnWWkhdQJMCY8UF7NKan2aRLUkqyndP/wZrp7Nk=; b=bzQ/BmbzvVM6KkyEo+ROOfTSQ2ZOYGBzq3P8rGolVuMbsk7rr8rJIHZhqkOS4njhyn 3VezpNfu1C2dRxWypdVRII/vJFrpDCMu3aNlCVbsalxon8POAP7klDPXZgO4gz70nrB8 C9kbfwywarHw5QDRa9i83OEmXaTtrctBdwmJqFQkWkZjOvg+17UydgU4ex97Ts4o4bwm AoGiojNyZ0QRSLNUjhsIbSNtInQej1Myxvfx4/GuvwiqistfhsOGJh8402ikbjNfncGv p/1n8uxD24ruvfpk7NJyLDwDu8//CLX3nDXs7Bbz4x1yi79gdfEwUX8y/Cw7xQNOm4T0 h4Zg== 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=ZvU8lnWWkhdQJMCY8UF7NKan2aRLUkqyndP/wZrp7Nk=; b=OteoIXYZYtRS6wmce5ey/sHJdZAWvmvVbmikQ45YMYx1/pZQlugyfvcfJqTjoPov3+ txazXehzddJ/WZ3LOpgz2LB7ULHtEWKz8nriNkk2jXXd1GJZR97iH3Vm76Fn7DO2gphP AVUhvazK7fn171RW2QyNdW8MiLqnZnHXxYqXxwUWCoIDFozrRJMGQP7waIefCuPwBzjL Z9v3x5wd6BjhxtTG7l8xVyQS1Op6XHtWPqq72lSQOgw2vWryGog8yIs7VMRAh4JmQbXw e75U/DW638JlSdOvo0UMs9pQrnsauXshitNvPZXPIABVBOY5qF0npGVmiiItmFAuz9Bi fhEQ== X-Gm-Message-State: AOAM53183EzBFbeB7rGWHDMOtzr8ZB72wgIHF9fwI2U3esH1whIs4wfU VWMiCVmvnFczVDTOKqK6m0xFUt5AATtRNW7zAg== X-Google-Smtp-Source: ABdhPJySul96irPoC325ymdW97EovrSynSI0wmWGlsa6rwfZwvQCTzziMufC8odtZFjq9iaIvvi2pHhWmlKum/CkmVU= X-Received: by 2002:a9d:7517:: with SMTP id r23mr2595362otk.146.1606844729098; Tue, 01 Dec 2020 09:45:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 1 Dec 2020 09:45:16 -0800 Message-ID: To: "Christoph M. Becker" Cc: "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: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.