From:             dron007 at yahoo dot com
Operating system: Linux
PHP version:      5.2.4
PHP Bug Type:     Session related
Bug description:  HTML img src tag resets session variable

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 bug report at http://bugs.php.net/?id=42791&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42791&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42791&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42791&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42791&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42791&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42791&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42791&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42791&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42791&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42791&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42791&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42791&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42791&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42791&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42791&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42791&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42791&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42791&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42791&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42791&r=mysqlcfg

Reply via email to