-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix online user location when there is unicode in the URL #71
base: master
Are you sure you want to change the base?
Conversation
that's odd, it works fine for me and I have unicode characters (日本語 - Japanese) in thread and forum titles (mybb-1.6, php-7.2). I'll test with mybb-1.8 later... |
It has been a while since the first time I encountered this problem, but I remember that it was not happening for all users. It was happening for some users. IIRC, it was happening when there was |
Looking at my sessions table in more detail, there were some entries that looked like affected users, but it also happened to threads with no UTF-8 in the suject. Somehow somewhere, URLs are slipping past. But that may be a separate issue. |
OK, the URL slip-past happens when browsing the text-only archive like https://community.mybb.com/archive/index.php?thread-123.html I still can't reproduce errors when browsing the regular forum. Can you confirm your issue is unrelated to archive browsing? |
I got some time to reproduce the problem. The problem is consistently reproducible and it does not need the URL to have extra arguments. It happens for both forums and threads that I tested. |
Hm, copying random strings from Persian Wikipedia does not reproduce the issue for me either. Is your database encoding utf8 or utf8mb4? Is it possible for you to provide the output of |
My database encoding is actually Here are encoded versions of an example URL that reproduces the issue:
On the public website, that thread is: https://www.academiacafe.com/pf/Thread-%D9%85%DB%8C%D8%B2%D8%A7%D9%86-%D8%B4%D8%A7%D9%86%D8%B3-%D8%AF%D8%B1-%D8%A7%D8%AE%D8%B0-%D9%88%DB%8C%D8%B2%D8%A7%DB%8C-%D8%AA%D9%88%D8%B1%DB%8C%D8%B3%D8%AA%DB%8C-%D8%A2%D9%85%D8%B1%DB%8C%D9%83%D8%A7 |
To be clear, the encoded URL and location are from my local machine, not from the public website. I provided the link to the public website just in case it might be needed. |
OK, that explains a lot. Your $location is urlencoded (%hex) instead of UTF-8. No wonder str_replace() doesn't work. This might trace back to $_SERVER['QUERY_STRING'] not being UTF-8 but urlencoded in your case. This is unexpected. But not the first time such an issue appears with nginx/PHP vs. Apache/PHP. Is there anything special about your webserver/php configuration? |
No, that's not right either... scratches head |
test.php
Calling in browser directly as Calling as That's... confusing. That's... confusing. |
calling as with [B] flag added to the RewriteRule it's It seems for years I've been relying on some Apache rewrite oddity without noticing, haha. Well, it's MyBB's own get_current_location() that relies on it, but they don't expect odd characters after all... I'll try to come up with a fix for this, ugh. |
Interesting findings! The last one ( I don't use any particularly interesting configuration in my nginx with respect to character encoding. |
The location of some online users is not shown correctly if the URL of the location has unicode characters. It is shown only as viewing a thread or a forum without specifying which thread or forum.
Each UTF-8 character in the URL is converted to a few ascii letters which cause some PHP string search functionality including
str_replace
to fail.This PR fixed the issue.