﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
15820,"Under a specific condition, session variables declared in templates exhibit unexpected behavior",dougwaltman,,"I believe I have discovered a very peculiar bug that occurred when I tried to set a single session variable in a template file, ""header.php"", and call it again after refreshing the page.  I have written a quick snippet of code that can be used to replicate the issue.  This code will:

 * Start the session
 * Display some HTML
 * Create an array of values
 * Shuffle the values
 * Display the first value as ""new""
 * Display the session variable of the last stored value
 * Set the session variable to the ""new"" one

Add the following code to the top  of ""header.php"" in any template:

{{{
<?php
session_start();
?>
<link rel=""icon"" href=""<? bloginfo('template_url') ?>/images/x"" />
<?php
  $myarray = array(
    'a','b','c','d','e'
  );
  shuffle($myarray);
  echo ""<pre>New: "".$myarray[0];
  echo ""\nOld: "".$_SESSION['last_one_displayed'];
  $_SESSION['last_one_displayed'] = $myarray[0];
  exit;
?>
}}}

After refreshing the page several times, you will notice that the value for ""old"" isn't matching the ""new"" value from the previous refresh.  The code will behave as expected if you do any number of things, including:

 * Change 'rel=""icon""' to anything else, suchas 'rel=""icons""' or 'rely=""icon""'
 * Remove the 'rel=""icon""' attribute entirely
 * Remove the 'x' from the end of the url
 * Remove the '<? bloginfo('template_url') ?>' snippet
 * Move the '<link...' line below the rest of the code

I suspect that this bug has something to do with the code that compiles and displays the template.
  ",defect (bug),closed,normal,,Themes,3.0.3,minor,invalid,,
