|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Marco Smarty Rookie
Joined: 17 Feb 2004 Posts: 6 Location: The Netherlands, Amsterdam
|
Posted: Fri Apr 23, 2004 9:47 am Post subject: core.write_file.php Permission denied and File Exists |
|
|
I have experienced problems when I use my own errorhandler function.
Smarty sometimes has trouble reading the templates.
I get errors on line 41 unlink (Permission denied ) and 43 rename (File Exist)
My Error_Handler function also contains some ignores of other errors generated by smarty.
Here's the source:
set_error_handler('Lookup_ErrorHandler');
function Lookup_ErrorHandler( ){
global $aDebug;
if ( func_num_args() > 0 ){
$args = func_get_args();
$errortype = array (
1 => "Error",
2 => "Warning",
4 => "Parsing Error",
8 => "Notice",
16 => "Core Error",
32 => "Core Warning",
64 => "Compile Error",
128 => "Compile Warning",
256 => "User Error",
512 => "User Warning",
1024 => "User Notice",
4096 => "Developer Error"
);
//check if error is not caused by Smarty_Compiler.class.php lineNr 1390
//Temporary workaround for Smartyclass error, Smarty has been notified on 10-03-2004
if( $args[3] == 1390 && eregi( 'Smarty_Compiler.class.php', $args[2] ) ) {
return true;
}
// check if false error is not caused by debugging (Notice Line: 1 in variable expression)
if ($args[0] == 8 && $args[3] == 1 && $args[2] == 'variable expression') {
return true;
}
// Ignore fsockopen errors
if (eregi('fsockopen', $args[1])) {
return true;
}
showerror($errortype[$args[0]], "Where: ", "Line: $args[3] in $args[2]", "Message: ", $args[1]);
saveerror($args[0], $args[1], $args[2], $args[3], "");
}
return true;
}
function showerror($Caption, $Title1, $Message1, $Title2 ="", $Message2 = "", $bSaveError = false) {
global $aDebug;
if ($aDebug['showerror']) {
print ('<table border="0" style="border: 2px solid red ; font-family : Arial; font-size : 13px; background-color: white">');
print ("<tr><td colspan=2>");
print ("<font style=\"font-weight: 600\">$Caption</font>");
print ("</td></tr><tr><td>");
print ("$Title1</td><td>");
print ("<font style=\"color: blue\">$Message1</font>");
print ("</td></tr><tr><td>");
print ("$Title2</td><td>");
print ("<font style=\"color: blue\">$Message2</font>");
print ("</td></tr>");
print ("</table>");
}
if ($bSaveError) {
saveerror("4096", $Message1, "", "", $Message2);
}
} |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Apr 23, 2004 9:57 am Post subject: Re: core.write_file.php Permission denied and File Exists |
|
|
Marco wrote: | I have experienced problems when I use my own errorhandler function.
Smarty sometimes has trouble reading the templates.
I get errors on line 41 unlink (Permission denied ) and 43 rename (File Exist) |
that's why these function-calls are silenced with the @-operator.
your error_handler should check if the first parameter ($errno) is 0, if so the error_handler was triggered inside an operation that was explicitely and conciously silenced with an '@'. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|