#22671 [Ana]: IMG SRC not able to get SESSION values

2003-03-13 Thread ronneil at restricted dot dyndns dot org
 ID:   22671
 User updated by:  ronneil at restricted dot dyndns dot org
 Reported By:  ronneil at restricted dot dyndns dot org
 Status:   Analyzed
 Bug Type: Session related
 Operating System: FreeBSD 4.7 and Redhat 7.3
 PHP Version:  4.3.0
 New Comment:

I have tried the same code and followed what you told me. I have
removed the session_destroy() and still, I am not able to extract any
values from the session variables. I have noticed that it works when I
used include(test2.php). But I can't used this function since the
real code that I have does generate real image.

You should try the code and you will see what I mean.

Thanks. I will wait for another response.


Previous Comments:


[2003-03-13 01:36:25] [EMAIL PROTECTED]

You explicitly destroy the session right there at the bottom of
test1.php.  Why do you think that the session will still be around by
the time the request for the test2 image comes through?  Chances are
that test1 has finished executing by then and thus you session data has
been destroyed.



[2003-03-13 01:31:31] ronneil at restricted dot dyndns dot org

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;$ipage4;$ipage++) {
   for ($i=0;$icount($time_VAR);$i++) {
   $_SESSION[$ipage][] = $time_VAR[$i];
   }

// the following loop verifies if SESSION variable was populated
   for ($i=0;$icount($_SESSION[$ipage]);$i++) {
   echo $i.) .$_SESSION[$ipage][$i].br;
   }
   $pagenum = $ipage;
   $arraysize = count($_SESSION[$ipage]);
   echo Pagenum : $pagenum, Size of current array :
$arraysizebr;
   echo 'img
src=test2.php?count='.$pagenum.'varsize='.$arraysize.'';
   echo New linebrbr;
   }
   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;$icount($atemp_alltel_VAR);$i++) {
$err = fwrite($fp, $atemp_alltel_VAR[$i]);
}
fclose($fp);
?





-- 
Edit this bug report at http://bugs.php.net/?id=22671edit=1



#22671 [NEW]: IMG SRC not able to get SESSION values

2003-03-12 Thread ronneil at restricted dot dyndns dot org
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;$ipage4;$ipage++) {
   for ($i=0;$icount($time_VAR);$i++) {
   $_SESSION[$ipage][] = $time_VAR[$i];
   }

// the following loop verifies if SESSION variable was populated
   for ($i=0;$icount($_SESSION[$ipage]);$i++) {
   echo $i.) .$_SESSION[$ipage][$i].br;
   }
   $pagenum = $ipage;
   $arraysize = count($_SESSION[$ipage]);
   echo Pagenum : $pagenum, Size of current array : $arraysizebr;
   echo 'img
src=test2.php?count='.$pagenum.'varsize='.$arraysize.'';
   echo New linebrbr;
   }
   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;$icount($atemp_alltel_VAR);$i++) {
$err = fwrite($fp, $atemp_alltel_VAR[$i]);
}
fclose($fp);
?

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