User tests: Successful: Unsuccessful:
Pull Request for Issue #15544
Check cache file before use.
To save a cache file joomla requires lock method.
To create a lock for cache joomla has to create a file in the cache folder.
If a view method raise an error then cache process is hung up and the file can not be deleted.
The file is left empty.
Next request could find such file and display it as empty article.
Check if the cache file is not empty.
I have added a more explanation at #10767 (comment)
Take a look at the issue.
Error 404
Blank component.
No
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Easy | No | ⇒ | Yes |
RTC after two successful tests.
This works. Why do we need to create an empty file though. I'm worried about forcing sites with inode restrictions that people accessing pages that don't exist can just try and access 100 404 id'd and suddenly you've managed to destroy their site.
I have the same feelings but lock()
method is not very flexible.
Do you know a way to lock file without creating it?
Currently we have steps if page exists:
If error 404:
exit()
4. Save data to file.
5. Unlock file.
6. Display data.
This PR can wait, maybe we will find a better way.
Maybe try looking at Symfony's LockHandler for inspiration?
With 4.0 their new Lock component may also be helpful?
I think about add register_shutdown_function
to cache file constructor.
The function will do:
foreach ($this->_locked_files as $path => $handle)
{
if ($handle && filesize($path) === 0)
{
@flock($this->_locked_files[$path], LOCK_UN);
@fclose($this->_locked_files[$path]);
@unlink($path);
}
}
Yes
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-27 15:22:57 |
Closed_By | ⇒ | csthomas | |
Labels |
Added:
?
|
I have tested this item✅ successfully on 6fdb602
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15558.