OSDN Git Service
(root)
/
pukiwiki
/
pukiwiki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6ff00c
)
get_source(,,$join=TRUE): Care for 0 byte files
author
henoheno
<henoheno>
Sun, 29 Jul 2007 12:18:08 +0000
(21:18 +0900)
committer
umorigu
<umorigu@gmail.com>
Sun, 30 Nov 2014 00:34:28 +0000
(09:34 +0900)
lib/file.php
patch
|
blob
|
history
diff --git
a/lib/file.php
b/lib/file.php
index
86baffe
..
066d100
100644
(file)
--- a/
lib/file.php
+++ b/
lib/file.php
@@
-31,7
+31,12
@@
function get_source($page = NULL, $lock = TRUE, $join = FALSE)
if ($join) {
// Returns a value
- $result = str_replace("\r", '', fread($fp, filesize($path)));
+ $size = filesize($path);
+ if ($size > 0) {
+ $result = str_replace("\r", '', fread($fp, filesize($path)));
+ } else {
+ $result = '';
+ }
} else {
// Returns an array
// Removing line-feeds: Because file() doesn't remove them.