php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7530 Session does not store Objects
Submitted: 2000-10-30 09:38 UTC Modified: 2000-11-28 06:34 UTC
From: ori at chikki dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.3pl1 OS: Red Hat Linux 6.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ori at chikki dot net
New email:
PHP Version: OS:

 

 [2000-10-30 09:38 UTC] ori at chikki dot net
Session do not store objects! They are deleted and does not appear in the /tmp/sess_************ file associated with the session.

This does not affect normal session variables.

Downgrading to PHP4.0.2 solved the problem.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 09:51 UTC] stas@php.net
Surely sessions can include objects. Please provide short script that reproduces behaviour that you do not like.
 [2000-11-01 02:18 UTC] andi@php.net
Also can you please check the latest snapshot from snaps.php.net to see if it works for you now?
 [2000-11-01 05:43 UTC] ori at chikki dot net
Sample code as follows:
______________________________________________
// The Class
class Count
{
 var $counter;

 function add()
 {
  return $this->count++;
 }
}// End class
______________________________________________


// The session
// start up the sessions - use SESSION Array
session_start();
session_register("SESSION");

/* initialise the Count objct if necessary */
if (!isset($SESSION["Count"])) {
	$SESSION["Count"] = new Count;
}

The problem is when trying to manipulate $SESSION["Count"]->add() - which does the required calculations, but does store the session for later use (the /tmp/sess_***** file).
 [2000-11-01 06:06 UTC] ori at chikki dot net
Andi - I checked the latest version you recommended - but I cannot evaluate it since the support for mySQL does not seem to work properly.

Ori
 [2000-11-01 06:25 UTC] stas@php.net
Works for me in latest version. Please try it.
 [2000-11-01 06:40 UTC] stas@php.net
You may want also to check your register_globals setting...
 [2000-11-01 06:52 UTC] ori at chikki dot net
recompiled using the 4.0.3pl1 and the register_globals in on. There is still a problem with objects in the $SESSION array.

If you need to take a look at the application - I may be able to allow access to HTTP on my linux box.
 [2000-11-01 06:59 UTC] andi@php.net
Can you create a small reproducing script? That would help out a lot.

 [2000-11-01 07:12 UTC] ori at chikki dot net
The entire script I used is long - here is a summary:

<?
class Counter
{
	var $counter;
	
	function add()
	{
		return $this->counter++;
	}
}

session_start();
session_register("SESSION");

/* initialise the SESSION variable if necessary */
if (!isset($SESSION)) {
	$SESSION = array();
}

/* initialise the Counter objct if necessary */
if (!isset($SESSION["Counter"])) {
	$SESSION["Counter"] = new Counter;
}

echo "Visits using normal variables: " . $SESSION["visit"]++;
echo "<BR>";
echo "Visits using classes: " .  $SESSION["counter"]->add;
?>

Ori
 [2000-11-27 08:50 UTC] sniper@php.net
Should be fixed in CVS. Please try latest snapshot from
http://snaps.php.net/ and reopen this bug report if
this doesn't work with it.

--Jani
 [2000-11-27 08:51 UTC] sniper@php.net
Should be fixed in CVS. Please try latest snapshot from
http://snaps.php.net/ and reopen this bug report if
this doesn't work with it.

--Jani
 [2000-11-27 13:46 UTC] waldschrott@php.net
ori, if you check it again, don't use your script supplied
in this bug report, there are errors in it...
1) $SESSION["Counter"]->add();

works for me too

 [2000-11-28 06:34 UTC] ori at chikki dot net
I checked the latest release from snaps.php.net (php4-200011280245) and it seems to fix the bug problem with the sessions. I then checked again with 4.0.3pl1 and it did not work properly - seems like you fixed the bug...

Ori
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 15:01:33 2024 UTC