note 103215 modified in function.fwrite by danbrown

From: Date: Fri, 01 Apr 2011 13:06:16 +0000
Subject: note 103215 modified in function.fwrite by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178408@lists.php.net to get a copy of this message
Be careful of using reserved Windows filenames in fwrite operations. <?php $fh = fopen('prn.txt', 'w'); fwrite($fh, 'wtf?'); echo 'done' . PHP_EOL; ?> The above script will hang (tested on Windows 7) before it can echo 'done'. This is due to another 'feature' of our favourite operating system where filenames like prn.xxx, con.xxx, com1.xxx and aux.xxx (with xxx being any filename extension) are Windows reserved device names. Attempts to create/read/write to these files hangs the interpreter. --was-- Be careful of using reserved Windows filenames in fwrite operations. <? $fh = fopen('prn.txt', 'w'); fwrite($fh, 'wtf?'); echo 'done' . PHP_EOL; ?> The above script will hang (tested on Windows 7) before it can echo 'done'. This is due to another 'feature' of our favourite operating system where filenames like prn.xxx, con.xxx, com1.xxx and aux.xxx (with xxx being any filename extension) are Windows reserved device names. Attempts to create/read/write to these files hangs the interpreter. More info: http://tinyurl.com/3ulvjwk http://php.net/manual/en/function.fwrite.php

« previous php.notes (#178408) next »