note 103215 added to function.fwrite
| From: | JonHaynes at osu1 dot php dot net | Date: | Fri, 01 Apr 2011 10:48:06 +0000 |
| Subject: | note 103215 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178401@lists.php.net to get a copy of this message | ||
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
----
Server IP: 109.169.40.147
Probable Submitter: 194.73.116.130
----
Manual Page -- http://www.php.net/manual/en/function.fwrite.php
Edit -- https://master.php.net/note/edit/103215
Del: integrated -- https://master.php.net/note/delete/103215/integrated
Del: useless -- https://master.php.net/note/delete/103215/useless
Del: bad code -- https://master.php.net/note/delete/103215/bad+code
Del: spam -- https://master.php.net/note/delete/103215/spam
Del: non-english -- https://master.php.net/note/delete/103215/non-english
Del: in docs -- https://master.php.net/note/delete/103215/in+docs
Del: other reasons-- https://master.php.net/note/delete/103215
Reject -- https://master.php.net/note/reject/103215
Search -- https://master.php.net/manage/user-notes.php