revolution
revolution copied to clipboard
Bug with filemtime() for static elements in Windows
Bug report
Summary
If you have static elements (snippets, plugins, chunks) some times you'll get this error (in Windows).
[2020-10-18 23:33:54] (ERROR @ D:\Projects\test.local\www\core\model\modx\modscript.class.php : 146) PHP warning: filemtime(): stat failed for D:/Projects/test.local/www/core/cache/includes/elements/modplugin/26.include.cache.php
Step to reproduce
- Create a static snippet or plugin.
- Clear the cache.
- Refresh the page.
- Open the error log.
Environment
MODX 2.8.0. PHP 7.4. Windows 7, 10.
The filemtime()
check will not be executed if the $includeFilename
is not readable, so your screenshot is not identifying the correct issue.
You are wrong. Take a look at the documentation.
You are wrong. Take a look at the documentation.
I don't know what you are talking about. That call never executes if $result
is false
which it will always be if the file does not exist yet. Take a look at the code.
I see. I was inattentive. Then why does this error appear? The problem looks like the lexicon cache issue.
I see. I was inattentive. Then why does this error appear? The problem looks like the lexicon cache issue.
I'm having no luck reproducing the issue, so I do not know yet.
I'm afraid this must be something unique to that particular plugin. I cannot recreate the issue with a basic plugin.
It's strange. I got this issue in my laptop with several static plugins. (The picture above from my desktop)
Ok. I'll dig further.
I think I got it. This happens only on Windows.
Anything the core should take into consideration?
@Mark-H I have no idea. There are no problems on Ubuntu.
@Mark-H @sergant210 Windows has a problem with filemtime, maybe this comment will come in handy https://www.php.net/manual/en/function.filemtime.php#100692
Maybe we should reopen this issue? Because the error log is constantly full of unnecessary lines.