fopen('.', 'r') succeedes !?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Discovered today: fopen() opens '.' and '..' but fread() returns nothing
without errors nor end-of-file, so this loop:

    $f = fopen('.', 'r');
    if( $f === FALSE ) die("fopen failed");
    $n = 0;
    while(($s = fread($f, 10)) !== FALSE)
        $n += strlen($s);
    fclose($f);
    echo "total bytes read: $n\n";

never ends! The same happens with '..'. Tested on PHP 5.6.3 and 7.0.0
under Slackware 14.1 32-bits. Under Vista, instead, fopen() fails as
expected.

Bug or specific feature under Linux?

Regards,
 ___ 
/_|_\  Umberto Salsi
\/_\/  www.icosaedro.it


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux