Revisión | b454dea7d560a721856490b77b6f5370dbf68c54 (tree) |
---|---|
Tiempo | 2007-07-29 21:18:08 |
Autor | henoheno <henoheno> |
Commiter | henoheno |
get_source($join=TRUE): Care for 0 byte files
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone. |
3 | -// $Id: file.php,v 1.81 2007/07/28 14:41:56 henoheno Exp $ | |
3 | +// $Id: file.php,v 1.82 2007/07/29 12:18:08 henoheno Exp $ | |
4 | 4 | // Copyright (C) |
5 | 5 | // 2002-2007 PukiWiki Developers Team |
6 | 6 | // 2001-2002 Originally written by yu-ji |
@@ -38,7 +38,12 @@ function get_source($page = NULL, $lock = TRUE, $join = FALSE) | ||
38 | 38 | |
39 | 39 | if ($join) { |
40 | 40 | // Returns a value |
41 | - $result = str_replace("\r", '', fread($fp, filesize($path))); | |
41 | + $size = filesize($path); | |
42 | + if ($size > 0) { | |
43 | + $result = str_replace("\r", '', fread($fp, filesize($path))); | |
44 | + } else { | |
45 | + $result = ''; | |
46 | + } | |
42 | 47 | } else { |
43 | 48 | // Returns an array |
44 | 49 | // Removing line-feeds: Because file() doesn't remove them. |