includes/bootstrap.inc:

/**
 * Return all messages that have been set.
 *
 * As a side effect, this function clears the message queue.
 */
function drupal_get_messages() {
  $messages = drupal_set_message();
  $_SESSION['messages'] = array();

  return $messages;
}

$_SESSION['messages'] = array(); does not clear the array for some reason. I am guessing the bug is in PHP5 itself.

unset($_SESSION['messages']); does not clear it as well, the only thing I have got to work is session_unregister('messages');

PHP 5.0.4:

System => Linux server 2.6.9-rock #1 SMP Fri Dec 17 08:39:08 EST 2004 i686
Build Date => Apr 26 2005 01:02:22
Configure Command =>  './configure' '--prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libdir=/usr/lib' '--datadir=/usr/share' '--includedir=/usr/include' '--infodir=/usr/info' '--mandir=/usr/man' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-debug' '--enable-libpam' '--enable-pam' '--with-apxs2=/opt/apache/sbin/apxs' '--with-zlib' '--with-bz2' '--with-pgsql=/opt/postgresql' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-gd' '--with-freetype-dir=/usr' '--with-imap' '--with-imap-ssl' '--with-config-file-path=/etc' '--with-openssl' '--enable-calendar' '--with-curl' '--with-gdbm' '--with-db4' '--enable-dio' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--with-kerberos' '--with-gmp' '--with-gettext' '--with-ldap=/opt/openldap' '--with-ldap-sasl=/usr' '--with-ncurses' '--enable-pcntl' '--with-pspell' '--with-readline' '--enable-shmop'
'--with-snmp' '--enable-ucd-snmp-hack' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--with-libxml-dir=/usr' '--with-xsl' '--with-xmlrpc' '--enable-yp' '--enable-mbstring=all' '--enable-mbregex' '--build=i386-t2-linux-gnu' '--host=i386-t2-linux-gnu'

I am using files for session saving.

Comments

dopry’s picture

Status: Active » Closed (won't fix)

I'm going to assume that since its been 6 months and we're at 4.6.6 that this is no longer an issue. Correct me if I'm wrong.

autowitch’s picture

Version: 4.6.0 » 4.6.6

I have the same problem under 4.6.6.

markus_petrux’s picture

Maybe related to the fact that session variables can be lost when header('Location: ') is invoked?

Could you please try this?

In includes/bootstrap.inc, find:

session_start();

after that line, add:

register_shutdown_function('session_write_close');
markus_petrux’s picture

or try this?

In includes/common.inc, find:

header('Location: '. $url);

BEFORE that line, add:

session_write_close();