#42791 [Opn->Fbk]: HTML img src tag resets session variable

From: Date: Sat, 29 Sep 2007 02:36:46 +0000
Subject: #42791 [Opn->Fbk]: HTML img src tag resets session variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117945@lists.php.net to get a copy of this message
ID: 42791 Updated by: jani@php.net Reported By: dron007 at yahoo dot com -Status: Open +Status: Feedback Bug Type: Session related Operating System: Linux PHP Version: 5.2.4 New Comment: With what browser are you trying this with? IIRC, there was some issue with IE and broken html and it not sending some headers then. Previous Comments: ------------------------------------------------------------------------ [2007-09-28 17:55:24] dron007 at yahoo dot com Description: ------------ There was the bug already posted: http://bugs.php.net/bug.php?id=25966 I also have the similar situation. IMG tag with empty src attribute deletes session variable. Yes, it is incorrect <IMG> tag but I spent a lot of time debugging this situation and I was very surprized that HTML code have an influence on PHP variables. Reproduce code: --------------- File 1.php: <? session_start(); $_SESSION["some_var"] = null; if (isset($done)) { $_SESSION["some_var"] = 1; header("Location: 2.php"); die(); } ?> <a href="1.php?done=1">Goto 2</a> --------------------------------------- File 2.php: <? session_start(); echo 'some_var='.$_SESSION["some_var"].'<br>'; echo '<img src="">'; ?> Expected result: ---------------- I first load file 1.php, then go by link which sets session variable, then I see "some_var=1" which is correct. If I reload 2.php I expect to see "some_var=1" Actual result: -------------- "some_var=" Session variable is destroyed. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42791&edit=1

« previous php.bugs (#117945) next »