Re: Re: PHP 8 is_file/is_dir input handling
| From: | G. P. B. | Date: | Tue, 01 Dec 2020 17:46:29 +0000 |
| Subject: | Re: Re: PHP 8 is_file/is_dir input handling | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112338@lists.php.net to get a copy of this message | ||
On Tue, 1 Dec 2020 at 17:45, Paul Crovella <paul.crovella@gmail.com> wrote:
> On Tue, Dec 1, 2020 at 9:25 AM Christoph M. Becker <cmbecker69@gmx.de>
> 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
>
>