SMF Development > Fixed or Bogus Bugs

Cookies / sessions issues

(1/1)

AliG:
Hi,
there is a problem with sessions when you turn off cookies or use some web proxy for filtering (like Privoxy).

It works quite fine to login or such, but after you post a new topic,
login session is lost as it redirects to wrong page

Incorrect
forum.server.cz/index.php/topic,31.new.html#new?PHPSESSID=7t1ajcqoebcuebkg5kghjgje62

Correct
forum.server.cz/index.php/topic,31.new.html?PHPSESSID=7t1ajcqoebcuebkg5kghjgje62#new

There might be some more such problems when you force cookies to be "per-session" in Privoxy.
But this wrong url is the main one.

SMF 2.0.2 (latest), modifications, language, server settings or such do not influence this behaviour,
"Return to topics after posting" has to be allowed in your profile

emanuele:
Hello AliG and thank you for the report!

Yes, there seems to be a problem with the preg_reaplce that converts the "friendly urls" within the redirect exit.

Please try this fix: in Subs.php search this code:

--- Code: (find) --- $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2?' . SID", $setLocation);

--- End code ---

and replace it with

--- Code: (replace with) --- $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2'", $setLocation);

--- End code ---

emanuele:
I committed the fix of that too. I hope I didn't break anything. :P

Commit: 188cdf7592f7e5430ab68dd5d062c788df53d313

Fixed posting with cookies disabled and search engine friendly urls - thanks AliG for the report [Topic 479197]

Navigation

[0] Message Index

Go to full version