Jump to content

Recommended Posts

I was told that using a Session will allow me to capture an Object and pass it between pages.

 

I tried following what I read online and what someone sugegsted but it is not working.

 

This is the error I get when running my test application...

 

Catchable fatal error: Argument 1 passed to Microwave::receiveItem() must be an instance of Bowl, instance of __PHP_Incomplete_Class given, called in /Users/user1/Documents/DEV/++htdocs/Soup/cook.php on line 13 and defined in /Users/user1/Documents/DEV/++htdocs/Soup/classes/Soup.class.php on line 31

Call Stack

# Time Memory Function Location

1 0.0095 56412 {main}( ) ../cook.php:0

2 0.0101 68272 Microwave->receiveItem( ) ../cook.php:13

 

I would really appreciate it if someone could look at my code and see where the problem is at.

 

My guess is that it is in cook.php, but who knows?!

 

Attached is a ZIP of my entire directory structure.

 

Thanks,

 

 

TomTees

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/214856-issue-using-session-with-objects/
Share on other sites

I'm not looking at the zip but you must serialize the object before you put it in the session and then you must include the class on the next page before you start the session or try to unserialize it, can't remember which.

Php serializes/un-serializes all session data when it is written/read to/from the session data file. You don't need to do it a second time in your class.

 

 

I thought that is what I read in the PHP manual, but as usual, the PHP manual isn't the most well written document in the world!!!

 

It implies that PHP will be changing how all of this is handled...

 

So, to be certain, PFMaBiSmAd, you are saying that if I store my Objects in a Session variable, then that is all I have to do, correct?  (And I can ignore all of this repeated talk about Serialization, right?)

 

On a related note, how do the "pros" do all of this stuff??

 

For instance, let's say I'm back to working on my *real* website, and I an working with things like "User" and "Registration" and "Shopping Cart" classes that have important and sensitive data n them.

 

What is the safest way to handle things as a User naviagtes my E-commerce site??

 

From what I was reading over at Stack Overflow, PHP is considered "wimpy" in how it does not handle state between web pages the way a more sophisticated solution like Java does?!  Can someone please elaborate on this topic??  (I am very interested and concerned, because I want to build a RELIABLE and SECURE E-commerce site, and don't want to be taking any shortcuts!)

 

Thanks,

 

 

 

TomTees

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.