A bug in the latest HTML_Template_PHPLIB-1.3.
| From: | chihwen | Date: | Wed, 11 Jun 2003 04:50:35 +0000 |
| Subject: | A bug in the latest HTML_Template_PHPLIB-1.3. | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-17290@lists.php.net to get a copy of this message | ||
Dear~
I found a bug in the latest HTML_Template_PHPLIB-1.3.
The latest HTML_Template_PHPLIB-1.3 has a little bug about logic
judgment on 510 lines.
This bug acts fine above PHP 4.3.0, but an ERROR occured on others PHP
version.
The ERROR message is
Fatal error: Call to undefined function: file_get_contents() in
/usr/local/lib/php/HTML/Template/PHPLIB.php on line 510
You can use file_get_contents(), if you use PHP >= 4.3.0.
So an error occured.
The original code is:
if (!function_exists("file_get_contents")) {
$str = file_get_contents($filename);
} else {
if (!$fp = @fopen($filename,"r")) {
$this->halt("loadfile: couldn't open $filename");
return false;
}
$str = fread($fp,filesize($filename));
fclose($fp);
}
My modification is:
if (function_exists("file_get_contents")) {
$str = file_get_contents($filename);
} else {
if (!$fp = @fopen($filename,"r")) {
$this->halt("loadfile: couldn't open $filename");
return false;
}
$str = fread($fp,filesize($filename));
fclose($fp);
}
FYI.
Regards,
---------------------------------------------------------------------
Chih-Wen Yang, Engineer
Technical R&D Division / 4th R&D Section
Yam Digital Technology Co., Ltd.
Email: chihwen@staff.yam.com
Tel: +886-2-2502-3000 Ext.7051
Fax: +886-2-2516-0669
http://www.yam.com/