Welcome Guest, Not a member yet? Register   Sign In
CI 1.7 Session Bug within object storage
#11

[eluser]hSATAC[/eluser]
CI 1.7.1 was released few days ago, I went through the changelog but I saw nothing related to Session class.

Perhaps this is a "feature" instead of "bug".

I haven't download 1.7.1 to tryout that if it's fixed of not.

Anyone wanna try it?
#12

[eluser]lukeinjax[/eluser]
I am experiencing this same issue. I've added the MY_Session file with the code above to my libraries folder, but I'm getting the following error:

Code:
A PHP Error was encountered

Severity: 4096

Message: Object of class __PHP_Incomplete_Class could not be converted to string

Filename: libraries/MY_Session.php

Line Number: 71

Anyone else having this issue?
#13

[eluser]littleram[/eluser]
[quote author="lukeinjax" date="1234830581"]I am experiencing this same issue. I've added the MY_Session file with the code above to my libraries folder, but I'm getting the following error:

Code:
A PHP Error was encountered

Severity: 4096

Message: Object of class __PHP_Incomplete_Class could not be converted to string

Filename: libraries/MY_Session.php

Line Number: 71

Anyone else having this issue?[/quote]


This happens if you initialise the session before you've loaded the class definitions for the object you're trying to save into the session. Ensure that you've include()'d or require()'d all the class definitions before you load the session library.
#14

[eluser]TheFuzzy0ne[/eluser]
The above post is spam. Can we delete it so we aren't indexing their Web site via Google.

EDIT: The post above is no longer spam. Big Grin
#15

[eluser]Benedikt[/eluser]
The fix works seems for storing an object (even the session-data is huge afterwards), but how can I retrieve the object from the session?

When I store an object like
Code:
$this->session->set_userdata('object', $this->object);
I try to retrieve it via
Code:
$this->session->userdata('object');
which seems not to work.

What am I doing wrong? Thanks for an example.
#16

[eluser]j2more[/eluser]
I hate to be negative but I am very fustrated with the quality of CI_Session. Despite the long history still nothing that works reliable.

I would have loved to stay with the framework in such a rather core part but now switched to native session for good. I couldnt get the serialization bug fixed in the 1.7.1. version. I thought it has maybe to do with the stripslashes and UTF8 - where CI is not compilant btw. .

Maybe this might be of interest for someone: My design decisions after numerous investigation regarding sessions are as follows:

1. Would have loved to use CI_Session as to have a scalable easy Session storage out of the box (session hijacking and security are not so a concern for us), also because I could have managed my session < 4kb. CI Session is not production quality and we cannot live with this.
2. We use File storage in favor of DB storage using native sessions. Why? Db is not faster (think overhead of establishing connnection), file storage works out of the box and has less failure points and needs less maintenance at our stage of the project.
3. Use Database when running multiple servers
4. Use Memcache if we in this distributed set up run into performance problems.
5. Also for performance consider op cache like APC or eAccelerator later

Cheers
#17

[eluser]jpi[/eluser]
I agree with j2more.

Thanks hSATAC for his trick with !is_object.

To CI's developper : what's the point in using serialize() (line 691, library/session.php) if the only thing you can store in session is a string (because of str_replace, which works only on string) ?
#18

[eluser][At!][/eluser]
Wow Thank you.

Worked wonders for me.
#19

[eluser]instantations[/eluser]
Great fix. Thank you guys!

I can't believe this is the second time I have to fix this. I did it the lazy way before (patching the core) and, of course, I erased it when upgrading to 1.7.2... Silly me!
#20

[eluser]sl3dg3hamm3r[/eluser]
I also run into this issue which seems to be still there in 1.7.2 - please fix for 1.7.3.




Theme © iAndrew 2016 - Forum software by © MyBB