php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5200 Session Support for Objects
Submitted: 2000-06-23 06:30 UTC Modified: 2000-06-26 01:35 UTC
From: tite at wolstudios dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0 Release Candidate 2 OS: SuSe 6.4
Private report: No CVE-ID: None
 [2000-06-23 06:30 UTC] tite at wolstudios dot com
Hello.

I am trying to have objects and/or classes through php scripts using the session support, but it doesn?t work at all.

Is this a future feature? Is it not going to be implemented? if not... why? does the web server's session support doesn?t allow it? would php-dev be interested in something like this?

Thank Your for your help.

Josafat Moragrega Fernandez
Director Tecnico
Web On Line Studios

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-24 02:08 UTC] stas at cvs dot php dot net
Yes it does work. Please provide more info.
 [2000-06-25 20:00 UTC] tite at wolstudios dot com
What I try to do is to be able to see objects declared in
a php web from another web (in the same session). Something
like this.

test.php:

session_start();
class Cart { 
  ......

$carrito = new Cart;
session_register("carrito");

?><A HREF="next_page.php">Next</A><?php
....

next_page.php:
session_start();
/* If I do it with the class, the sentence
$carr = new Cart;  
Will give me an error **/
echo "<H1>Jur!... (".$carrito->items["10"].")<BR>\n";
/* This will not show any result when in test.php does
show the desired result **/


I am running php 4.0 with Apache 1.3.12
The above scripts will work for variables and arrays.

Thank You again.

Josafat Moragrega Fernandez



 [2000-06-25 21:56 UTC] stas at cvs dot php dot net
Please define class before session_start
 [2000-06-26 01:35 UTC] tite at wolstudios dot com
Thank you for your help. :) It does work when the session_start is placed 
after the creation of the object. I Tried it under Apache 1.3.6 and Php 4.0b3.

Those same scripts in a Apache 1.3.12 with Php 4.0 dont work. In fact, no 
session suport is available. 

A file is created in /tmp like this.
-rw-------   1 nobody   nogroup         9 Jun 26 01:31 sess_12bed2b02a7d0c1098ab1a9976cf79f1
with content:
!carrito|

instead of:
carrito|O:8:"stdClass":1:{s:5:"items";a:1:{i:10;i:3;}}
That shows the machine with the Php 4.0b3

The php.ini file is exactly alike from one machine to anotherone.

Any ideas why does this happen?

Thank you again.
Josafat Moragrega Fernandez
Directorio Tecnico
Web On Line Studios
www.wolstudios.com
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 04:03:45 2023 UTC