File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
lib/classes/Swift/ByteStream Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public function getPath()
77
77
*
78
78
* @param integer $length
79
79
*
80
- * @return string
80
+ * @return string|boolean
81
81
*
82
82
* @throws Swift_IoException
83
83
*/
@@ -93,13 +93,21 @@ public function read($length)
93
93
ini_set ('magic_quotes_runtime ' , 1 );
94
94
}
95
95
$ this ->_offset = ftell ($ fp );
96
+
97
+ // If we read one byte after reaching the end of the file
98
+ // feof() will return false and an empty string is returned
99
+ if ($ bytes === '' && feof ($ fp )) {
100
+ $ this ->_resetReadHandle ();
101
+
102
+ return false ;
103
+ }
96
104
97
105
return $ bytes ;
98
- } else {
99
- $ this ->_resetReadHandle ();
100
-
101
- return false ;
102
106
}
107
+
108
+ $ this ->_resetReadHandle ();
109
+
110
+ return false ;
103
111
}
104
112
105
113
/**
You can’t perform that action at this time.
0 commit comments