mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
supress fopen errors, return false if cache file won't load
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
|||||||
|
- added index key example to QUICKSTART guide (Monte)
|
||||||
|
|
||||||
Version 1.4.6
|
Version 1.4.6
|
||||||
-------------
|
-------------
|
||||||
- fixed bug with {assign ...} when passing an empty value. (Monte)
|
- fixed bug with {assign ...} when passing an empty value. (Monte)
|
||||||
|
@@ -1070,7 +1070,7 @@ function _run_mod_handler()
|
|||||||
function _read_file($filename)
|
function _read_file($filename)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!($fd = fopen($filename, 'r'))) {
|
if (!($fd = @fopen($filename, 'r'))) {
|
||||||
$this->_trigger_error_msg("problem reading '$filename.'");
|
$this->_trigger_error_msg("problem reading '$filename.'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1089,7 +1089,7 @@ function _run_mod_handler()
|
|||||||
if ($create_dirs)
|
if ($create_dirs)
|
||||||
$this->_create_dir_structure(dirname($filename));
|
$this->_create_dir_structure(dirname($filename));
|
||||||
|
|
||||||
if (!($fd = fopen($filename, 'w'))) {
|
if (!($fd = @fopen($filename, 'w'))) {
|
||||||
$this->_trigger_error_msg("problem writing '$filename.'");
|
$this->_trigger_error_msg("problem writing '$filename.'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1227,6 +1227,10 @@ function _run_mod_handler()
|
|||||||
{
|
{
|
||||||
$results = $this->_read_file($cache_file);
|
$results = $this->_read_file($cache_file);
|
||||||
|
|
||||||
|
if(empty($results)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// get the files involved with this cache from the first line
|
// get the files involved with this cache from the first line
|
||||||
$contents = explode("\n", $results, 2);
|
$contents = explode("\n", $results, 2);
|
||||||
|
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("Smarty.class.php");
|
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
|
|
||||||
$smarty->compile_check = true;
|
$smarty->compile_check = true;
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("Smarty.class.php");
|
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
|
|
||||||
$smarty->compile_check = true;
|
$smarty->compile_check = true;
|
||||||
|
@@ -1070,7 +1070,7 @@ function _run_mod_handler()
|
|||||||
function _read_file($filename)
|
function _read_file($filename)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!($fd = fopen($filename, 'r'))) {
|
if (!($fd = @fopen($filename, 'r'))) {
|
||||||
$this->_trigger_error_msg("problem reading '$filename.'");
|
$this->_trigger_error_msg("problem reading '$filename.'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1089,7 +1089,7 @@ function _run_mod_handler()
|
|||||||
if ($create_dirs)
|
if ($create_dirs)
|
||||||
$this->_create_dir_structure(dirname($filename));
|
$this->_create_dir_structure(dirname($filename));
|
||||||
|
|
||||||
if (!($fd = fopen($filename, 'w'))) {
|
if (!($fd = @fopen($filename, 'w'))) {
|
||||||
$this->_trigger_error_msg("problem writing '$filename.'");
|
$this->_trigger_error_msg("problem writing '$filename.'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1227,6 +1227,10 @@ function _run_mod_handler()
|
|||||||
{
|
{
|
||||||
$results = $this->_read_file($cache_file);
|
$results = $this->_read_file($cache_file);
|
||||||
|
|
||||||
|
if(empty($results)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// get the files involved with this cache from the first line
|
// get the files involved with this cache from the first line
|
||||||
$contents = explode("\n", $results, 2);
|
$contents = explode("\n", $results, 2);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user