PHP adds "532142118" to session variable
I've got a very strange problem with hopefully a very simple explanation, but after hours of debugging I can't figure out what's happening.
LAMP stack is used, php 5.4
Here is a simplified version of the system wich still reproduces some strange behavior.
In a simple, self made framework, I made a horizontal menu (tabs) wich 'remembers' what url was active when the page in that tab is used for searching etc. So if you come back later to that tab, you immediately can see the last search results, because of the get parameters.
So one 'tab' in the menu, activates on this url:
/customer/2/customer_email/
This variable is put into a session variable: $_SESSION['tab_menu']['customer_email'] = $_SERVER['REQUEST_URI'];
After a page refresh, or navigating to another tab, the url of the tab can be read out of the session. BUT for some reason, the stored url is changed to:
/customer/2/customer_email/532142118
If I put GET parameters behind the url, the same strange number is inserted by ... whatever process. So if I access the tab with this url:
/customer/2/customer_email/?foo=bar
The session array will look like this on the same page load:
$_SESSION['tab_menu']['customer_email'] = /customer/2/customer_email/?foo=bar
But after I navigate to another page, the session data will read:
$_SESSION['tab_menu']['customer_email'] = /customer/2/customer_email/532142118
I verified that the $_SESSION array looks okay by var_dump($_SESSION) at the last point in the code. I verified that the $_SESSION data the next refresh is changed by dumping it's data right after session_start() in the beginning of the code.
If I do this, for testing, the strange number is not added in the session data:
$_SERVER['REQUEST_URI'] = '/customer/2/customer_email/';
If I navigate to another another url, the same problem will not occur:
/customer/3/customer_email/
More things I tried: C
Questions:
Hoping on some reactions / input!
Edit: added point 7 & 8 to "things I tried"
FINALLY an answer !
And thanks to this answer that pointed me in the right direction:
PHP session variable changes between pages
The pages I made, and that had problems with the session, are showing imported emails. Some emails are loading not existing images, with a html source of:
<img border="0" width="110" height="114" id="_x0000_i1025" src="532142118" />
So on the background, this would load the url appended with "532142118", completely integrated in network statistics and that would not show any visible var_dumps on the screen.
I fell back to email myself function traces at the point where the session variable was set, to conclude the page was requested multiple times. The extra requested page, due to the image source, would malform the session and requested url.
Now I exclude specific url requests to not put the url in the session variable, so wrong img sources will not affect the system :)
Thank you all for the input !
链接地址: http://www.djcxy.com/p/59728.html上一篇: php ajax控制会话变量消失