The flash is actually supposed to be destroyed on a page refresh. It is supposed to only be displayed once and destroyed. The flsh is meant to be used as a one time status/event notification message, not as something to be persisted across requests.
On Thu, Jun 4, 2009 at 12:37 PM, tonio607 <[email protected]> wrote: > > Hi, > > I have a very strange bug in my application. I use symfony 1.2.7, > Doctrine and sfGuard. > > I have a search functionnality with many criterias and I use the > DoctrinePager to display the result. The criterias are persisted with > a flash variable. > > The problem is when I use Internet Explorer (6 or 7), a click on next > page destroy the flash (but not the entire session). On all the other > browsers, it works well. It works also when there is security is set > to off. And it works and when I don't display the template (ie return > sfView::NONE). These three elements are not very helpful to make a > diagnosis. > > I check the request (cause I thought it was the only difference) and > the differences between the header is the presence of HTTP_KEEP_ALIVE: > '300', and HTTP_CACHE_CONTROL: max-age=0 in firefox but not in IE. > But I'm pretty sure it's not due to the cache (which is turned off in > symfony and in the browsers). > I also tested just with a string, rather than an array in the flash. > It doesn't change anything. > I tried to display the $_SESSION to bypass the symfony getFlash or > getAttribute with a namespace but the variable corresponding to the > flash is empty indeed. > I tested the setFlash() which seems to work well as long as you don't > reload the page... > I also sniff the request with Fiddler to see if it was not a problem > with the request sent by IE. I didn't find anything. > > Here is a piece of code : > > public function executeRechercherDossier(sfWebRequest $request) > { > $this->form = new EnregistrementDossierFormFilter(); > > // Traitement du formulaire > if ($request->isMethod('post')) > { > $valeurs = $request->getParameter($this->form->getName()); > $this->form->bind($valeurs); > if ($this->form->isValid()) > { > // Envoi des critères de recherche valides à la page de > résultat > $this->getUser()->setFlash('criteres', $valeurs); > $this->redirect('enregistrement/listeDossiers'); > } > } > } > > > public function executeResults(sfWebRequest $request) > { > $criteres = $utilisateur->getFlash('criteres', array()); > /*$this->forward404Unless($criteres != null, 'Vous devez arriver > du > formulaire de recherche pour afficher cette page.');*/ > $utilisateur->setFlash('criteres', $criteres); > > // Récupération des résultats de la recherche > $form = new EnregistrementDossierFormFilter(); > $query = $form->buildQuery($criteres); > $this->rappelCriteres = $form->afficheCriteres($criteres); > > // Récupération des informations de tri et d'ordre > $this->tri = $request->getParameter('tri', 'r.numero'); > $this->ordre = $request->getParameter('ordre', 'asc'); > $trisPossibles = array('r.numero', 'r.libelle_demande', > 'et.numero', > 'ctc.nom'); > if (!in_array($this->tri, $trisPossibles)) > { > $this->tri = 'r.numero'; > } > // Test si l'ordre est valide > if ($this->ordre != 'asc' && $this->ordre != 'desc') > { > $this->ordre = 'asc'; > } > // Construction du pager > $pagination = MyPager::getPagination('Dossier'); > $this->pager = new MyPager($query, $pagination); > $this->dossiers = $this->pager->getResults(); > } > > > If somebody has anything to provide about such things, I would be > very thanksfull. > > > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
