Closed (fixed)
Project:
Drupal core
Version:
5.8
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Oct 2005 at 18:15 UTC
Updated:
22 Jul 2008 at 12:45 UTC
Qube found a real solution to http://drupal.org/node/27098
Comments
Comment #1
chx commented... the file is at http://drupal4hu.com/bootstrap.patch
Comment #2
pgregg commented4.3.6 patch:
diff -ru /usr/local/src/drupal-4.6.3/includes/session.inc includes/session.inc
--- /usr/local/src/drupal-4.6.3/includes/session.inc 2005-08-10 21:43:03.000000000 +0100
+++ includes/session.inc 2005-10-12 19:19:20.756771760 +0100
@@ -8,6 +8,7 @@
session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
session_start();
+$user->session =& $_SESSION;
/*** Session functions *****************************************************/
Paul Gregg, aka Qube (but not here)
Comment #3
dfg commentedIf this solves the repeating bug, you can tell me:
Why could drupal_set_message() add (set) something to the session (1), but drupal_get_messages() not empty (2) it?
(1) $_SESSION['messages'][$type][] = $message
(2) $_SESSION['messages'] = array()
Comment #4
dries commentedI too would like to understand what's happening. It's a hariy solution and I'm not fond of these unless I fully understand what's going wrong.
Comment #5
dries commentedComment #6
dopry commentedBump
Comment #7
moshe weitzman commentedi don't see a patch there. also, please don't bump issues. if you must, contact developers privately about issues which you feel need more attention.
also, we just submitted a session.inc rewrite which might change this anyway. is in 'ready for review' queue at the moment.
Comment #8
markus_petrux commentedTo make sure session variables are written when redirections occur (as it happens when Drupal forms are submitted), try calling session_write_close() just before header('Location: ...') in function drupal_goto().
To unset a session variable when register_globals is ON, you may need to explicitly unset the global itself. Also, I believe the proper way to unregister a global variable from within a function is through the $GLOBALS array, so:
On an aside... here's a funny experiment:
1) Goto admin/settings
2) Press the 'Save Configuration' button and, after a few milliseconds, hit the Escape key to abort the request.
3) Press the 'Save Configuration' button again.
You'll see the "The configuration options have been saved." duplicated.
This is because, drupal_set_message() was called before you hit the Escape key (the message was stored in session variables and those were written to db), but drupal_get_messages() was not called yet.
The second time you sent the form, drupal_set_message() is called again, hence the same exact message is appended to the $_SESSION array, then a redirection takes place and then drupal_get_messages() is called, getting both messages.
This could be prevented if drupal_set_message was checking for dups. ie. instead of:
it could do:
Comment #9
jbrown commentedhow was this fixed in drupal 4.7??
Comment #10
magico commentedThis should be fixed on HEAD by now! At least the code had significant changes...
Comment #11
coreb commentedMoving out of the "x.y.z" queue to a real queue.
Also marking it "To be ported" so that someone more knowledgeable can determine if this is still needed/relevant.
Comment #12
killes@www.drop.org commentedno patch attached.
Comment #13
chx commentedComment #14
(not verified) commentedComment #15
netdragon commentedI'm having this issue with Drupal 5.1 on Windows with Apache 2 -- is it really fixed?
Comment #16
netdragon commentedFor anyone using 5.1, the lines of code in the patch can be found in bootstrap.inc
Comment #17
moksa commentedI've PHP5 Apache 2 and drupal 5.8 and still this problem.
patch is still not include ??
Thanks in advance
++
Comment #18
damien tournoud commented@moksa: I guess the issue you may face is really different than this old one, please open a new issue and give as much detail as possible about your problem.
Comment #19
moksa commentedIt's done.