Error in: Sources/Cache/APIs/FileBased.php (Γραμμή 62)

Started by Panoulis64, April 05, 2022, 10:39:08 AM

Previous topic - Next topic

Panoulis64

For some days now, management has been showing me this error. And it raises questions for me, where does it come from!
After I found it, a few days ago, along with an error in the Ultimate Menu, we thought with the server administrator and went back 48 hours to the forum and everything looked fine.
Yesterday I had the same problem again. I thought it would be Themes and I changed it. For a few hours, all is well. And 3-4 hours ago, it started showing me an error again.
I attach two photos with the problem and the code that shows that there is an error, although I did not see any difference, downloading 2.1.1 for file comparison.
Note that in the shoutbox, he mentions, I never did anything today !!!
You cannot view this attachment.     You cannot view this attachment. 

Doug Heffernan

This looks to be related to a mod called ehPortal. Mod related questions should be posted on their support topics.


Arantor

Firstly, ehPortal doesn't have a support topic (might be one in the author's site), but the error looks like a core bug that the file cache isn't handling a mismatch between the stat cache and the file system correctly.

The code needs a change to put @ before fopen on that line. (There's no way around it, file operations can fail for no reason and the warning just has to be ignored.)

Panoulis64

Quote from: Doug Heffernan on April 05, 2022, 10:46:01 AMThis looks to be related to a mod called ehPortal. Mod related questions should be posted on their support topics.

EhPortal is about one slaughter, I have four in total for today.
1st index.php? Action = profile; area = alerts_popup; counter = 0; u = 1
2nd index.php action = ehportal_shout; shoutbox_id = 1; shoutbox_dir = 0; fc0491ac008e = 4e6fd4a14e77d7c25f8c1d5d3975ebce; xml2
3rd index.php? Action = profile; area = alerts_popup; counter = 0; u = 1
4ον index.php? Action = profile; area = alerts_popup; counter = 0; u = 1
and all have this path public_html / Sources / Cache / APIs / FileBased.php (Line 62) which is the code I posted

QuoteThe code needs a change to put @ before fopen on that line. (There's no way around it, file operations can fail for no reason and the warning just has to be ignored.)
About @ I did not understand.
My biggest problem, apart from the fact that it is a bit soul-destroying to see an error, I have a problem with issue jane 2, because its menu is broken.You cannot view this attachment.

Doug Heffernan

Quote from: Panoulis64 on April 05, 2022, 11:19:24 AMI have a problem with issue jane 2, because its menu is broken.

You can post at that theme 's support topic about this.

https://www.simplemachines.org/community/index.php?topic=578800.0

For future reference, whenever you are having an issue with a third party mod and/or theme, the best course of action is to first post at their support topics.


Panoulis64

Quote
QuoteΠαράθεση από: Panoulis64 στις Σήμερα στις 03:19:24 ΜΜ
I have a problem with issue jane 2, because its menu is broken.

You can post at that theme 's support topic about this.

https://www.simplemachines.org/community/index.php?topic=578800.0

I know that.
The discussion, however, was not about that, but the errors.
Now if my English is not so good, I apologize

Doug Heffernan

Quote from: Panoulis64 on April 05, 2022, 12:05:43 PMI know that.
The discussion, however, was not about that, but the errors.
Now if my English is not so good, I apologize

No need to apologize and your english seems good enough to me :)

Quote from: Panoulis64 on April 05, 2022, 11:19:24 AMAbout @ I did not understand.

I did not see the code, but @Arantor says that it is a core bug and that the at sign ( @ ) should be prepended to fopen so any any error that might be generated by that expression will be suppressed/ignored.

Can you post the code that it is throwing the error? In meanwhile I am moving this to the Bug Reports forum so our devs can take a look at this.

Arantor

Code (find) Select
private function readFile($file)
{
if (($fp = fopen($file, 'rb')) !== false)
{
if (!flock($fp, LOCK_SH))
{
fclose($fp);
return false;
}

Code (replace) Select
private function readFile($file)
{
if (($fp = @fopen($file, 'rb')) !== false)
{
if (!@flock($fp, LOCK_SH))
{
@fclose($fp);
return false;
}

If you pass a file_exists due to stale stat cache but the file has been removed by another process (happens), fopen will fail with a warning that you can't do anything about except abort safely which the code does.

Similarly if flock fails, it safely aborts but any notice it throws is irrelevant. And if you're closing, any notice is irrelevant, you can't do anything about it.

Panoulis64


Panoulis64

Thank you very much for the help, the problem is solved or at least it shows as time.

@Doug Heffernan I forgot to mention where you said to go to the topic jane 2 to say the problem, unfortunately but this topic, although problems have been written like this https://www.simplemachines.org/community/index.php?topic=578800.msg4111755 # msg4111755\ and there is no response, as time.
That's why I had to change it thema.

Arantor


Advertisement: