|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-31 23:37 UTC] tomator at poczta dot onet dot pl
[2005-08-01 00:39 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 19:00:01 2025 UTC |
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.