Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

fread() and 0-length files

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
Ceph
Smarty Rookie


Joined: 25 Nov 2003
Posts: 24

PostPosted: Tue Jun 08, 2004 1:52 am    Post subject: fread() and 0-length files Reply with quote

In Smarty.class.php, line 1734 throws a wanring (error_reporting E_ALL) when trying to read a template of 0-length. freads() cannot read a file when the length is 0; a simple fix:

Original:
[php:1:48602c5e3a]if ($start == null && $lines == null) {
// read the entire file
$contents = fread($fd, filesize($filename));
} else {[/php:1:48602c5e3a]

to (or similiar):
[php:1:48602c5e3a]if ($start == null && $lines == null) {
// read the entire file
$contents = filesize($filename) ? fread($fd, filesize($filename)) : "";
} else {[/php:1:48602c5e3a]
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP