Re: Re: fopen('.', 'r') succeedes !?
| From: | Jasper Kips | Date: | Mon, 02 Mar 2015 19:33:21 +0000 |
| Subject: | Re: Re: fopen('.', 'r') succeedes !? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324571@lists.php.net to get a copy of this message | ||
> Op 2 mrt. 2015, om 20:27 heeft Umberto Salsi <salsi@icosaedro.it> het volgende
> geschreven:
>
> salsi@icosaedro.it (Umberto Salsi) wrote:
>
>> Discovered today: fopen() opens '.'
>> [rest of my bogus comments removed]
>
> Filed https://bugs.php.net/bug.php?id=69163 about fopen()
> opening a directory
> under Linux, when a more reasonable behavior would be to raise E_WARNING.
> Testing for is_dir() is a weak workaroud nobody does and it is not atomic.
>
> My error with fread() and the infinite loop was that EOF condition must be
> tested with feof(); fread() returns FALSE only after an error.
>
> Regards,
> ___
> /_|_\ Umberto Salsi
> \/_\/ www.icosaedro.it
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Mind though, under Linux, a directory is a file. A special one, granted, but it still is a file. So
the behaviour, apart from being unexpected, is not weird or even buggy.
Regards,
Jasper Kips
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s