Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unlink problem while cleaning up the Smarty cache #24

Closed
dstuecken opened this issue Apr 22, 2015 · 2 comments
Closed

unlink problem while cleaning up the Smarty cache #24

dstuecken opened this issue Apr 22, 2015 · 2 comments

Comments

@dstuecken
Copy link

We're experiencing E_WARNINGS with your unlink operation in smarty_internal_write_file.php:58 on PHP 5.6.3 on Windows, since it is not checking if the file exists.

An is_file wrapper may fixes this:

if (Smarty::$_IS_WINDOWS) {
            if (is_file($_filepath)) {
                // remove original file
                @unlink($_filepath);
            }
            // rename tmp file
            $success = @rename($_tmp_file, $_filepath);
        } else {

Full Stack trace:

E_WARNING: unlink(C:\xampp\htdocs\i-doit\src/themes/default/smarty/templates_c\de^ad3fc0693ee80efa44169c025761566a1d4777af.file.searchBar.tpl.php): No such file or directory
... 11 non-project frames
1
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_write_file.php" line 58 in unlink
2
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_write_file.php" line 58 in writeFile
3
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_template.php" line 200 in compileTemplateSource
4
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_templatebase.php" line 149 in fetch
5
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_template.php" line 284 in getSubTemplate
6
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_templatebase.php(151) : eval()'d code" line 40 in content_55361efcc69c05_24852998
7
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_templatebase.php" line 182 in fetch
8
File "C:\xampp\htdocs\i-doit\src\classes\libraries\smarty\libs\sysplugins\smarty_internal_templatebase.php" line 377 in display
9
File "C:\xampp\htdocs\i-doit\src\classes\components\isys_component_template.class.php" line 116 in display
10
File "C:\xampp\htdocs\i-doit\src\hypergate.inc.php" line 265 in include_once
11
File "C:\xampp\htdocs\i-doit\index.php" line 202 in <main>
@dstuecken dstuecken changed the title unlink problem with cleaning up the Smarty cache unlink problem while cleaning up the Smarty cache Apr 22, 2015
uwetews added a commit that referenced this issue May 4, 2015
@uwetews
Copy link
Contributor

uwetews commented May 4, 2015

In the early days of Smarty 3 tests showed bad performance of code like this
if (file_exists($file)) {
$foo = filemtime($file);
}
and other.

So '@' error suppression was chosen for performance reason and also deal with some rare race condition between concurrent PHP processes.

New tests showed that now is_file() is much faster.

dev-master is now updated to use is_file() checks but '@' error suppression is left to deal with the rare race conditions.

This change will be included in the soon upcoming 3.1.22 release.

@uwetews uwetews closed this as completed May 4, 2015
uwetews added a commit to smarty-php/smarty-phpunit that referenced this issue May 4, 2015
  - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (smarty-php/smarty#24)
@dstuecken
Copy link
Author

Thanks a lot! 👍 :-)

wisskid pushed a commit that referenced this issue Apr 12, 2020
  - improvement use is_file() checks to avoid errors suppressed by @ which could still cause problems (#24)
think-mcunanan pushed a commit to think-mcunanan/smarty that referenced this issue Mar 22, 2023
…eb-reservation-work-even-for-kirei-or-multi-kanzashi-account

Ticket #5140 make web reservation work even for kirei or multi kanzashi account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants