It seems like when I use the URL manager (I’m using ‘urlFormat’=>‘path’) and try to access a URL using one of the rules, the page is actually loaded twice.
I realized this because on some of my pages I increase a views variable by 1 each time someone views the page, and for some reason it was always increasing by 2.
I have a problem like that too, if I try to login/logout, I need to change to the contact site first before the
session is really cancelled, can anyone tell me what happens there? It happens with the generated yiic code that I’ve used together with the yii guide.
Crap, does this mean the problem hasn’t been solved? I’m building a forum, and using the URLManager as well - though it does not matter whether I use the shortened version or the full one. I use ‘++$topic->view_count’ (I’ve tried every other increment form, so that’s not it), but it increments twice.
Odd thing is, I’ve tried using ‘echo ++$topic->view_count’ to display what it’s doing, and it only increments once there - so it’s actually displaying the first run, and the second run is just being eaten. But I have checked the database before navigating away, and I can absolutely confirm that it’s doubling on page load, not anything else.
Edit: I did a debug_backtrace() dump, and it did indeed create two files (naming based on the view count) for a single page load. It’s a full 1.1MB in each file, and I have no idea what I’m looking for, but I did run a diff on them - the only difference is the user’s last online time, a change of two seconds. Not one other line changed between the two loads.
I think what might be happening is more than one rule gets applied, even though it should stop at the first match. If I take out all the rules except one, it seems to work as expected. I haven’t tried some of the new rules options in 1.1.7, that might work for my case, but it seems like it shouldn’t ever load more than once regardless.
This can also happen when you include external files that are rewritten to the current URL instad of the static file. Also CSS can cause this when you use background:url(’.’); or something similar…