From:             ronneil at restricted dot dyndns dot org
Operating system: FreeBSD 4.7 and Redhat 7.3
PHP version:      4.3.0
PHP Bug Type:     Session related
Bug description:  IMG SRC not able to get SESSION values

I am trying to retrieve values from a SESSION variable array. To retrieve,
I am using <img src=somefile.php>. Unfortunately, I am not able to see any
value. Below are 2 sample php files to recreate the error. "test1.php"
calls "test2.php" via <img src> TAG.

Currently in production, I have a working code
(http://restricted.dyndns.org/codes/ocishow1.php) that uses almost same
concept below but this one saves the data to a file first. This code calls
another php file (http://restricted.dyndns.org/codes/ocishow2.php) to
generate the graph and is called via <img src>.

--------------TEST CODE-------------------
FILENAME : test1.php
<?php
   session_start();
   $time_VAR = array(2343,3234,457,2356,6798,3467,34667,4578,2523);

   for ($ipage=0;$ipage<4;$ipage++) {
       for ($i=0;$i<count($time_VAR);$i++) {
           $_SESSION[$ipage][] = $time_VAR[$i];
       }

    // the following loop verifies if SESSION variable was populated
       for ($i=0;$i<count($_SESSION[$ipage]);$i++) {
           echo "$i.) ".$_SESSION[$ipage][$i]."<br>";
       }
       $pagenum = $ipage;
       $arraysize = count($_SESSION[$ipage]);
       echo "Pagenum : $pagenum, Size of current array : $arraysize<br>";
       echo '<img
src="test2.php?count='.$pagenum.'&varsize='.$arraysize.'">';
       echo "New line<br><br>";
   }
   session_destroy();
?>
-------------------------------------------------
FILENAME : test2.php
<?php
    session_start();
    $index = $_GET[count];
    $arraysize = $_GET[varsize];

    // file handling was written to verify the size of array and index if
there are really values on it
    $fp1 = fopen("/tmp/checkval.txt","w");
    $err = fwrite($fp1,"Pagenum : $index, Size of Array: $arraysize\n");
    fclose($fp1);
    
    for ($i=0;$i<$arraysize;$i++) {
        $atemp_alltel_VAR[] = $_SESSION[$index][$i];
    }
    // This is the only way I can verify 
    $fp = fopen("/tmp/testing","w");
    for ($i=0;$i<count($atemp_alltel_VAR);$i++) {
        $err = fwrite($fp, $atemp_alltel_VAR[$i]);
    }
    fclose($fp);
?>

-- 
Edit bug report at http://bugs.php.net/?id=22671&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22671&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22671&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22671&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22671&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22671&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22671&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22671&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22671&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22671&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22671&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22671&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22671&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22671&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22671&r=gnused

Reply via email to