ID:               33939
 User updated by:  tomator at poczta dot onet dot pl
 Reported By:      tomator at poczta dot onet dot pl
 Status:           Open
 Bug Type:         Session related
 Operating System: WinXP pro
 PHP Version:      5.0.3
 New Comment:

Now I know that server on which my script fails, works with Apache
2.0.54-2 and PHP 4.3.11-4.


Previous Comments:
------------------------------------------------------------------------

[2005-07-31 22:39:37] tomator at poczta dot onet dot pl

Description:
------------
I've made a small application that searches given website, gathers
links, follows them and collects informations about file sizes. Becouse
it's time consuming, for bigger sites my page is being reloaded few
times. All needed data are stored in and restored from $_SESSION.
Everything works fine if website is small enough to count it in one
step. If not, instead of final summary page I was getting a start page!
I found, that it was caused by destroyed session variables. But they
were to be destroyed at the end, where I include this file and after
the results should have been displayed. See attached code...

This is the only place where I use unset. When these lines are
commented, I can see a data presentation. But then I can't go back to
initial page (becouse of still existing session vars).

When unset were not commented, and I put exit() before them, the
results were visible.

So I think that after unsetting session vars script runs again from
begining and looses any informations stored already in output buffer.

Well, it seems it is. I put flush() before unsets and made it working
almost well.

I'm using WinXP Pro, PHP 5.0.3, Apache 2.0.43 (as service), P4 HT

It may be Apache related issue as I found it working on another server
with PHP 5.0.3 and server software IPL (iPlanet?) and not working on
another one with Linux - but don't know if it has an Apache and what
version.

Reproduce code:
---------------
<?php 
$files=$_SESSION['files'];       
$total=count($files);
$done=$_SESSION['fid'];             
$sum=0;
foreach ($files as $file) 
{
  if ($file['size']>0) $sum+=$file['size'];
}
?>
<TABLE><!--here some result presentation--></TABLE> 
<?php 
  unset ($_SESSION['files']);
  unset ($_SESSION['filter']);
  unset ($_SESSION['presentFiles']);
  unset ($_SESSION['fid']);
  unset ($_SESSION['url']);
  unset ($_SESSION['progress']);      
?>

Expected result:
----------------
A table should be wisible with results of counting that was done in
foreach loop.

Actual result:
--------------
If unset ($_SESSION['progress']) is enabled, I'm getting initial page,
like when entering first time.

If unset ($_SESSION['progress']) is disabled, application remembers
what should it display, but I'm getting messages about wrong indexes
(files, fid) and bad parameter of foreach.

If all unsets are disabled, results are fine, but application can't
return to it's initial state to take new job.


------------------------------------------------------------------------


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

Reply via email to