From 3079a7510f5e51b758ef2aabaf07a589862f5fee Mon Sep 17 00:00:00 2001 From: messju Date: Sat, 31 Dec 2005 19:17:05 +0000 Subject: [PATCH] fixed incompatible use of fread() in Smarty::_read_file() it choke on php-5.1.1 and later. thanks to andig for pointing this out. --- NEWS | 1 + libs/Smarty.class.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d4f666de..61adbc8f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - make Smarty::_read_file() work on latest php (messju) - fixed improper tokenization of certain inline math expressions (boots) Version 2.6.11 (Dec 14, 2005) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 327ad502..006bcfb9 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1715,7 +1715,10 @@ class Smarty function _read_file($filename) { if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) { - $contents = ($size = filesize($filename)) ? fread($fd, $size) : ''; + $contents = ''; + while (!feof($fd)) { + $contents .= fread($fd, 8192); + } fclose($fd); return $contents; } else {