Bug in My Little Forum (Bugs)

by danielb987, Wednesday, March 15, 2017, 15:18 (8 days ago)
edited by Auge, Thursday, March 16, 2017, 07:25

Hi,

I have now installed My Little Forum version 2.4.2 and I have found a bug related to Internet Explorer.

In the file index.php at lines 209 to 214 there is an IF-statement that checks if the web browser is Internet Explorer and if not, sends the header 'Cache-Control: public, max-age=300'.

The problem is that Internet Explorer no longer declare itself with the header HTTP_USER_AGENT as "MSIE" but instead as "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko".

See this page on why:
http://stackoverflow.com/questions/5125438/why-do-chrome-and-ie-put-mozilla-5-0-in-the-user-agent...

This results in that Internet Explorer caches the web page and therefore doesn't update the web page as it should. For example, if I go to the admin page and setting for spam protection and then change a setting and click "save" and then returns to the admin menu page and then go back to the page for spam protection settings, the settings has not been changed. If I reload the page, the settings is correct.

I have the same problem when I log out from the forum.

The solution on this problem is to change line 213 in index.php from:

header('Cache-Control: public, max-age=300');

to:

header('Cache-Control: private, no-cache="set-cookie"');

since as far as I know, there is no easy way to detect Internet Explorer. I have run a PHP script with phpinfo() from Internet Explorer and I cannot see any useful PHP variable to detect Internet Explorer.

I have another forum with the forum software phpBB3 and that forum sends the header 'Cache-Control: private, no-cache="set-cookie"' so that seems the best way to handle the problem.

Best regards,
Daniel Bergqvist

Avatar

Bug in My Little Forum

by Magma, Wednesday, March 15, 2017, 15:50 (8 days ago) @ danielb987

This is probably the reason why IE keeps logging me out and not going back to the right page as in the thread I created http://mylittleforum.net/forum/index.php?id=8505

I've found My Little Forum has never worked right in IE since using MLF.

Bug in My Little Forum

by danielb987, Wednesday, March 15, 2017, 16:20 (8 days ago) @ Magma

This is probably the reason why IE keeps logging me out and not going back to the right page as in the thread I created http://mylittleforum.net/forum/index.php?id=8505

I've found My Little Forum has never worked right in IE since using MLF.

I'm using Internet Explorer 11 in desktop version on Windows 8.1. I never uses Metro style in Windows 8.1.

But you are probably having the same problem as me.

Best regards,
Daniel

Avatar

Bug in My Little Forum

by Auge ⌂ @, Wednesday, March 15, 2017, 15:56 (8 days ago) @ danielb987

Hello

Thank you for the report.

In the file index.php at lines 209 to 214 there is an IF-statement that checks if the web browser is Internet Explorer and if not, sends the header 'Cache-Control: public, max-age=300'.

The problem is that Internet Explorer no longer declare itself with the header HTTP_USER_AGENT as "MSIE" but instead as "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko".

Not only, that the IE does not declare itself as "MSIE", the "Microsoft Internet Explorer" was renamed to "Internet Explorer" ("IE") and was succeeded by "Edge".

This results in that Internet Explorer caches the web page and therefore doesn't update the web page as it should.

The solution on this problem is to change line 213 in index.php from:
header('Cache-Control: public, max-age=300');
to:
header('Cache-Control: private, no-cache="set-cookie"');

I'm not convinced. With the code the browsers should cache the pages (for 300 seconds (5 minutes)). The IE was excluded from this solution because of problems as stated in the comment in front of the line #213 (#211 f.).

I have another forum with the forum software phpBB3 and that forum sends the header 'Cache-Control: private, no-cache="set-cookie"' so that seems the best way to handle the problem.

We will investigate and discuss this. Thank you.

Tschö, Auge

--
further development of mlf1

Bug in My Little Forum

by danielb987, Wednesday, March 15, 2017, 16:15 (8 days ago) @ Auge

The solution on this problem is to change line 213 in index.php from:
header('Cache-Control: public, max-age=300');
to:
header('Cache-Control: private, no-cache="set-cookie"');


I'm not convinced. With the code the browsers should cache the pages (for 300 seconds (5 minutes)). The IE was excluded from this solution because of problems as stated in the comment in front of the line #213 (#211 f.).

What the web browser SHOULD DO and what the web browser ACTUALLY DOES is two complete different things. :-D

By doing this change, and this change only, the problem was solved.

Unless the web server is very busy, there is not much need for cache. For the web sites I'm responsible for, web cache is not needed at all.

Best regards,
Daniel

Avatar

Bug in My Little Forum

by Auge ⌂ @, Thursday, March 16, 2017, 08:29 (8 days ago) @ danielb987
edited by Auge, Thursday, March 16, 2017, 08:55

Hello

The solution on this problem is to change line 213 in index.php from:
header('Cache-Control: public, max-age=300');
to:
header('Cache-Control: private, no-cache="set-cookie"');


I'm not convinced. With the code the browsers should cache the pages (for 300 seconds (5 minutes)). The IE was excluded from this solution because of problems as stated in the comment in front of the line #213 (#211 f.).


What the web browser SHOULD DO and what the web browser ACTUALLY DOES is two complete different things. :-D

???

By doing this change, and this change only, the problem was solved.

We will see. The header was introduced, because the Firefox jumped not to the scroll position of the prior page when using the browsers back button without the header. On the other hand the MSIE stored not the folding state of the threads on the main page with this header. Thatswhy this browser was excluded from the header.

We have to check, if your solution is not only the solution for the IE but also not the introduction of a misbehavior in other browsers.

Unless the web server is very busy, there is not much need for cache. For the web sites I'm responsible for, web cache is not needed at all.

I strongly disagree [edit]with this generalised form[/edit]. There is not only the more or less busy server, there is on the visitors side also the device(s) with internet connections with restrictions in speed or in the available monthly data volume. It's i.e. simply unnecessary to serve the background images and the images of the icons on every request. The HTML with the perhaps changed content on the other hand should be actualised (at least) within a short time without loosing the information about the state of the pages.

It might be a part of the solution to store a few more informations about the state in the users browser on the server and in the browser (JavaScript's localStorage and sessionStorage).

Tschö, Auge

--
further development of mlf1

Bug in My Little Forum

by danielb987, Thursday, March 16, 2017, 10:12 (8 days ago) @ Auge

What the web browser SHOULD DO and what the web browser ACTUALLY DOES is two complete different things. :-D


???

What I mean is that there has been a lot of frustration among web developers that different web browsers doesn't behave as they should. And Internet Explorer is a great sinner in this case.

Unless the web server is very busy, there is not much need for cache. For the web sites I'm responsible for, web cache is not needed at all.


I strongly disagree [edit]with this generalised form[/edit]. There is not only the more or less busy server, there is on the visitors side also the device(s) with internet connections with restrictions in speed or in the available monthly data volume. It's i.e. simply unnecessary to serve the background images and the images of the icons on every request. The HTML with the perhaps changed content on the other hand should be actualised (at least) within a short time without loosing the information about the state of the pages.

I live in a country there most people has an Internet connection of 100 Mbit/s and there an Internet connection of 10 Mbit/s is considered as slow. And there the problem with monthly data volume is that people are watching movies on their cell phones.

But I do understand what you are saying and that people in other countries than Sweden has a lot slower Internet connections.

However, the amount of data of a page from web forum like My Little Forum is very small in comparison to most other web pages, like news papers and Facebook. So for most visitors I still belive that it's not necessary to cache the pages from My Little Forum in the web browser.

And I got the solution to the problem from phpBB3, maybe the biggest software for web forums.

best regards,
Daniel

Avatar

Bug in My Little Forum

by Auge ⌂ @, Thursday, March 16, 2017, 10:51 (8 days ago) @ danielb987

Hello

Unless the web server is very busy, there is not much need for cache. For the web sites I'm responsible for, web cache is not needed at all.


I strongly disagree [edit]with this generalised form[/edit].


I live in a country there most people has an Internet connection of 100 Mbit/s and there an Internet connection of 10 Mbit/s is considered as slow.

That's fine for you. :-)

In Germany many people have connections with 6 or 16 MBit/s (gross). Faster connections (50 up to 400 MBit/s (gross)) are available mostly in towns. But that's not the problem I meant. The problem is the form of contracts for connection on mobile phones. There are limits from a few hundred megabytes to a few gigabytes per month. There are contracts, where you'll pay for more volume without ordering, with other contracts you can pay for more volume after ordering it and, last but not least, there are contracts, where your speed gets reduced to a few kilobits per second. Finally you don't want to reach the limit.

With LTE you can have a lot of month left, when your data volume is void.

And there the problem with monthly data volume is that people are watching movies on their cell phones.

That's not a "problem", that's one of the normal use cases.

However, the amount of data of a page from web forum like My Little Forum is very small in comparison to most other web pages, like news papers and Facebook.

Yes, it is. But the visits in a MLF-driven forum are normally not the only accesses to the internet.

And I got the solution to the problem from phpBB3, maybe the biggest software for web forums.

As said before, we will investigate and test it. Thank you so far.

Tschö, Auge

--
further development of mlf1

Bug in My Little Forum

by danielb987, Wednesday, March 15, 2017, 16:27 (8 days ago) @ danielb987

Here is a perfect illustration of the problem. I took this screen dump AFTER I had replied to the entry of Magma. As you can clearly see, my reply to the entry of Magma is not visible. This is a HUGE problem.

Best regards,
Daniel

[image]

Avatar

Bug in My Little Forum

by Magma, Wednesday, March 15, 2017, 23:10 (8 days ago) @ danielb987

Daniel I implemented your solution and it fixed my problem so thanks.

Avatar

Bug in My Little Forum

by Auge ⌂ @, Thursday, March 16, 2017, 07:32 (8 days ago) @ danielb987

Hello

The solution on this problem is to change line 213 in index.php from:

header('Cache-Control: public, max-age=300');

to:

header('Cache-Control: private, no-cache="set-cookie"');

Because of your and magmas reports, that your solution works with IE (what's with Edge?), I will test your solution in other browsers. There it has to work too.

Tschö, Auge

--
further development of mlf1

RSS Feed of thread
powered by my little forum