Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

3.1.2 PHP errors

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
SoN9ne
Smarty Rookie


Joined: 25 Feb 2010
Posts: 17

PostPosted: Wed Oct 05, 2011 8:04 pm    Post subject: 3.1.2 PHP errors Reply with quote

I have slowly been updating my sites to use the new Smarty engine.

I just noticed the 3.1.2 update and I made the proper edits to my template class but I am now noticing filemtime (Smarty-3.1.2/libs/sysplugins/smarty_resource.php line: 613) and unlink (Smarty-3.1.2/libs/sysplugins/smarty_internal_write_file.php line: 49) errors in my php error log.

The errors only occur once I purge the compile directory. I get the unlink errors because the files do not exist and I get a stat failed error for filemtime. The error is only on the initial load of the page after the compile is purged. After the first page load the error is gone (because the file now exist).

Can someone verify this is a bug?

Thanks and I will continue to try and isolate the cause of this but until then maybe someone else may have a fix or a suggestion.
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Oct 05, 2011 8:38 pm    Post subject: Reply with quote

you may want to have a look at http://www.smarty.net/docs/en/api.mute.expected.errors.tpl
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
SoN9ne
Smarty Rookie


Joined: 25 Feb 2010
Posts: 17

PostPosted: Wed Oct 05, 2011 9:16 pm    Post subject: Reply with quote

Thanks for your response but I am looking for a fix for the errors, not to suppress them. They just started happening today so I am looking into a plugin that may be causing this. I'm trying to identify if it's a Smarty bug or a plugin bug once I finish updating another project that is much lighter than the current one I was working on.

I appreciate your suggestion but that's not quite what I am looking for Smile
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Oct 05, 2011 9:26 pm    Post subject: Reply with quote

SoN9ne wrote:
Thanks for your response but I am looking for a fix for the
errors, not to suppress them.


You won't find a fix, as these "errors" are _deliberate_, they are _expected_.

here's a concise explanation of what's going on here (pulled from the Smarty source):


error muting is done because some people implemented custom error_handlers using set_error_handler and for some reason did not understand the following paragraph:

Quote:
It is important to remember that the standard PHP error handler is completely bypassed for the
error types specified by error_types unless the callback function returns FALSE.
error_reporting() settings will have no effect and your error handler will be called regardless -
however you are still able to read the current value of error_reporting and act appropriately.
Of particular note is that this value will be 0 if the statement that caused the error was
prepended by the @ error-control operator.


Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include
    @filemtime() is almost twice as fast as using an additional file_exists()
    between file_exists() and filemtime() a possible race condition is opened, which does not exist using the simple @filemtime() approach.

_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
SoN9ne
Smarty Rookie


Joined: 25 Feb 2010
Posts: 17

PostPosted: Wed Oct 05, 2011 9:38 pm    Post subject: Reply with quote

globe wrote:

Quote:
It is important to remember that the standard PHP error handler is completely bypassed for the
error types specified by error_types unless the callback function returns FALSE.
error_reporting() settings will have no effect and your error handler will be called regardless -
however you are still able to read the current value of error_reporting and act appropriately.
Of particular note is that this value will be 0 if the statement that caused the error was
prepended by the @ error-control operator.


Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include
    @filemtime() is almost twice as fast as using an additional file_exists()
    between file_exists() and filemtime() a possible race condition is opened, which does not exist using the simple @filemtime() approach.


That makes sense... Thank you for the information.
Always learning something new Very Happy
I think I have enough to be able to resolve this with my custom error handler.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP