note 40593 deleted from function.file-get-contents by irchtml
| From: | irchtml@php.net | Date: | Tue, 09 Mar 2004 08:24:06 +0000 |
| Subject: | note 40593 deleted from function.file-get-contents by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66473@lists.php.net to get a copy of this message | ||
Note Submitter: fontajos@phpeppershop.com
----
Under some circumstances only an empty string was returned by the function replacement
file_get_contents of ragnarokonline dot de. Here's a fix:
if (!function_exists('file_get_contents')) {
function file_get_contents($filename, $use_include_path = 0) {
$file = @fopen($filename, 'rb', $use_include_path);
if ($file) {
if ($filesize = @filesize($filename)) {
$filecontent = fread($file, $filesize);
}
else {
$filecontent = '';
while (!feof($file)) {
$filecontent .= fread($file, 1024);
}
}
fclose($file);
}
return $filecontent;
}
}