php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3179 Classnames of objects in session
Submitted: 2000-01-11 09:08 UTC Modified: 2000-01-11 09:24 UTC
From: peter at desk dot nl Assigned:
Status: Closed Package: Other
PHP Version: 4.0 Beta 3 OS: RedHat 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: peter at desk dot nl
New email:
PHP Version: OS:

 

 [2000-01-11 09:08 UTC] peter at desk dot nl
I have three .php-files, called in this order :

1) start session, set some general session-variables
2) generate object, store in session
3) call member-function, show results

Scripts 2 and 3 use a 'require' statement to include the class-definition, script 1 doesn't. The above order of calling scripts work fine. Session-file shows this :

tst|O:3:"app":6:{s:5:"start";s:9:"952606800";s:3:"end";i:952608600;s:4:"desc";s:2:"aa";s:8:"id_users";a:0:{}s:6:"errors";a:0:{}s:4:"time";i:0;}

Seems fine to me. Now, when I return and follow the three
steps _again_, I get an error that the member-function does not exist anymore. The session file now shows :

tst|O:7:"stdClass":6:{s:5:"start";s:9:"952606800";s:3:"end";i:952608600;s:4:"desc";s:2:"aa";s:8:"id_users";a:0:{}s:6:"errors";a:0:{}s:4:"time";i:0;}

Behold ! The classname has been changed ! No wonder I can't access its member-function.

I traced the problem to the fact that in step 1) the class definition is _not_ included (when I do, the problem disappears). However, the object in question is not used or referenced in step 1) (the session is, of course).

Is this a bug or a feature ? Do I have to include the class-definition every time I use the session ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-11 09:24 UTC] andrei at cvs dot php dot net
In order for sessions to deserialize the objects properly you have to
include() or require() the files that define the classes before the session
is started.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 11:01:37 2024 UTC