php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19380 Incorrect session handling
Submitted: 2002-09-12 14:40 UTC Modified: 2002-09-27 06:29 UTC
From: ctenedor at yahoo dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.2.3 OS: linux redhat 7.2 (2.4.7-10)
Private report: No CVE-ID: None
 [2002-09-12 14:40 UTC] ctenedor at yahoo dot com
It seems like unset function it's not working fine, when is used on $_SESSION variables. My script uses an array containing a list of items, and with a button, i clear that list (I only 'destroy' the variable, using unset. When the scripts check again for the existence of $_SESSION and isn't set, it's created, of course, empty)

/*Clear function (in file clear.php)*/

 if(isset($_POST['reset']))
 {
        unset($_SESSION['galery']);
 
 }
 header("location:showlist.php");


/*Show items in list (in file showlist.php)*/
session_start();
if(!isset($_SESSION['galery']))
   $_SESSION['galery']=array();
echo "List has ". count($_SESSION['gallery']) ." items";

This is only a sample. Supose that I have many lists, every of them accessible by a link. When I click a link, it should show the items of that collection, but it's not working, the session variable is not destroyed, and every list, show the same content.

I'm not using global variables since 4.2.1. Some scripts working fine become unstable when upgraded from 4.2.2 to  4.2.3

 './configure' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--disable-path' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-bz2' '--with-db3' '--with-exec-dir=/usr/bin' '--with-gd' '--with-gdbm' '--with-gettext' '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-regex=system' '--with-ttf' '--with-zlib' '--with-layout=GNU' '--enable-debugger' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-wddx' '--with-mysql' '--with-xml' '--with-png-dir=/usr/local/lib' '--with-pam_auth' '--with-imap=/usr/src/imap/lib' '--with-ldap' '--with-ftp' '--with-kerberos'

Cesar



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-12 15:38 UTC] kalowsky@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

Zeev and I talked about this awhile back, and I believe he implemented your requested feature.  Try a new snapshot, and see if that fixes things for you.  From what I recall, this functionality didn't exist previously.
 [2002-09-26 20:11 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2002-09-27 00:32 UTC] ctenedor at yahoo dot com
Well, I 'fixed' the problem using

$_SESSION=array();

to clear all session variables. 
and 

$_SESSION['variable']=NULL;

to clear individual.

The problem is, I think, when destroying session variables. In some systems, fail and causes problems, in other, the same code works fine. All this is about destroy variables in session array.

To avoid problems, I suspend use of unset.
 [2002-09-27 06:29 UTC] sniper@php.net
Using unset() works fine here with PHP 4.3.0-dev.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 13:01:29 2024 UTC