修訂 | 09ff72b7d27fefd33700a030bb4c073a804dd668 (tree) |
---|---|
時間 | 2014-11-30 09:34:28 |
作者 | henoheno <henoheno> |
Commiter | umorigu |
get_source($join=TRUE): Care for 0 byte files
@@ -31,7 +31,12 @@ function get_source($page = NULL, $lock = TRUE, $join = FALSE) | ||
31 | 31 | |
32 | 32 | if ($join) { |
33 | 33 | // Returns a value |
34 | - $result = str_replace("\r", '', fread($fp, filesize($path))); | |
34 | + $size = filesize($path); | |
35 | + if ($size > 0) { | |
36 | + $result = str_replace("\r", '', fread($fp, filesize($path))); | |
37 | + } else { | |
38 | + $result = ''; | |
39 | + } | |
35 | 40 | } else { |
36 | 41 | // Returns an array |
37 | 42 | // Removing line-feeds: Because file() doesn't remove them. |