- bugfix fopen() error handling at stream resources

This commit is contained in:
uwe.tews@googlemail.com
2011-05-14 10:18:10 +00:00
parent 184557ed46
commit 86586e5af4
2 changed files with 59 additions and 54 deletions

View File

@@ -1,4 +1,7 @@
===== SVN trunk ===== ===== SVN trunk =====
14/05/2011
- bugfix fopen() error handling at stream resources
13/05/2011 13/05/2011
- bugfix condition starting with "-" did fail at {if} and {while} tags - bugfix condition starting with "-" did fail at {if} and {while} tags

View File

@@ -1,18 +1,18 @@
<?php <?php
/** /**
* Smarty Internal Plugin Resource Stream * Smarty Internal Plugin Resource Stream
* *
* Implements the streams as resource for Smarty template * Implements the streams as resource for Smarty template
* *
* @package Smarty * @package Smarty
* @subpackage TemplateResources * @subpackage TemplateResources
* @author Uwe Tews * @author Uwe Tews
*/ */
/** /**
* Smarty Internal Plugin Resource Stream * Smarty Internal Plugin Resource Stream
*/ */
class Smarty_Internal_Resource_Stream { class Smarty_Internal_Resource_Stream {
public function __construct($smarty) public function __construct($smarty)
{ {
@@ -74,13 +74,15 @@ class Smarty_Internal_Resource_Stream {
{ {
// return template string // return template string
$_template->template_source = ''; $_template->template_source = '';
$fp = fopen(str_replace(':', '://', $_template->template_resource),'r+'); if ($fp = fopen(str_replace(':', '://', $_template->template_resource),'r+')) {
while (!feof($fp)) { while (!feof($fp)) {
$_template->template_source .= fgets($fp); $_template->template_source .= fgets($fp);
} }
fclose($fp); fclose($fp);
return true; return true;
} else {
return false;
}
} }
/** /**