This is a very tricky bug to find but, well, it exists! If you click login while viewing a question, it will store the URL of the question you were just at. It also strips /submit, which is probably part of important functionality. However, it causes errors if /submit is a valid part of the URL.

Consider http://stackoverflow.com/questions/833032/submit-is-not-a-function-in-javascript. If you were logged out at the time, and then hit "login", you would end up at the following page: http://stackoverflow.com/users/login?returnurl=%2fquestions%2f833032-is-not-a-function-in-javascript.

Note the error on the return URL: it's become http://stackoverflow.com/questions/833032-is-not-a-function-in-javascript. The removal of the slash results in a broken return URL.

Due to the nature of the bug, I have no idea whether or not it can be fixed, but no sense in not reporting it.

Reproduced in both Chrome and Firefox by a tag team effort by Shog9 and I. Extra thanks to user Thomas for initially bringing this to our attention.