php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13869 Object are not correctly serialized
Submitted: 2001-10-30 07:17 UTC Modified: 2001-11-20 11:03 UTC
From: tkessler at ibelgique dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.6 OS: Linux Red-Hat 7.1
Private report: No CVE-ID: None
 [2001-10-30 07:17 UTC] tkessler at ibelgique dot com
This bug made me searching 4 days...

First take a class definition in a file called "testclass.php":

class test{
  var $attribut;
}

--------------------------------------------------
Then make a "main.php" who contains :

	session_start();

	//HTML header
	echo "<html>";

	//Define frames
	echo '<frameset rows="80,*" border='.$bord_horz_size.' frameborder="yes" bordercolor='.$col_bord_horz.'>';

	echo '<frame name="status-frame" noresize scrolling="no" src="/status_gen/status_gen.php">';
	
	echo '<frameset cols="250,*" border='.$bord_vert_size.' frameborder="yes" bordercolor='.$col_bord_vert.'>';
	
	echo '<frame name="menu-frame" noresize scrolling="no" src="/menu_gen/menu_gen.php">';

	//THE main frame :
	echo '<frame name="main-frame" noresize src="/mainframe/mainframe.php">';
	
	//End of the frames
	echo "</frameset>";
	echo "</frameset>";

	//End of HTML
        echo "</html>";
-----------------------------------------

Now we define the "mainframe.php" :

require("test.php");

---------------------------------------
Let's define "test.php" :

require_once("testclass.php");
if (!isset($dummy)){
        $dummy = new testclass();
        $dummy->attribut = "foo bar";
        session_register("dummy");
}
else{
        echo $dummy->attribut;
}

---------------------------------------
When I refresh the mainframe it says :
"fatal error : The script tried to execute a method or access a property of an incomplete object. Please ensure that class definition (...).

The bug report #13298 give a walk arround :
include the class definition before the session_start but I can't do it beceause I've to start my session in the frame-definition-page.

I've to make an important presentation of our project in a few days and this problem is causing to me a lot of trouble...
I need some help!

Thx a lot!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-30 08:04 UTC] hholzgra@php.net
if this is really the complete code then i'd
guess you have session.auto_start enabled in
your php.ini?

if not then i'd recomend you create a special
include file for session startup that includes
all your class definitions and calls session_start()
on its last line

include this file at the very top of every
file that uses session data so that you can 
ensure that you have all class definitions 
read in *before* the session file is read

there is no feature for automagicaly including
class definitions for objects in a session (yet)
as we do not have a 1:1 mapping between file
and class names as java has so that the engine 
has no way to figure out which file to include 
for an object
 [2001-10-30 08:05 UTC] hholzgra@php.net
changed to feedback status

 [2001-11-20 11:03 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 21:01:30 2025 UTC