Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with php versions lower than 5.5.4 #8

Open
steffex opened this issue Mar 7, 2014 · 2 comments
Open

Incompatibility with php versions lower than 5.5.4 #8

steffex opened this issue Mar 7, 2014 · 2 comments

Comments

@steffex
Copy link
Contributor

steffex commented Mar 7, 2014

Session serialization of php is not the same as the functions serialize() and unserialize() prior to php version 5.5.4.

If you use Zend Framework 2 for example, $_SESSION becomes a multi-dimensional array and that is being serialized in such a way that it is incompatible with the phpserialize library.

Here is an example:

__ZF|a:1:{s:20:"_REQUEST_ACCESS_TIME";d:1394123316.861037;}Default|a:1:{s:10:"login_name";s:5:"admin";}

__ZF and Default are actually just key names in the $_SESSION array. This is what the array looks like if you do var_dump($_SESSION):

array(2) {
  ["__ZF"] => array(1) {
    ["_REQUEST_ACCESS_TIME"] => float(1394123316.861037)
  }
  ["Default"] => array(1) {
    ["login_name"] => string(5) "admin"
  }
}

Since php 5.5.4, you have the option php_serialize which uses the plain serialization functions of php. This will make sure that the session data is serialized with php's serialize() and resolves the issue of phpserialize not being able to process this weird serialization of the default method. Click here for more information about the ini setting.

Perhaps it is a good idea to add this sidenote to the documentation.

@winhamwr
Copy link
Owner

winhamwr commented Mar 7, 2014

Hi Stefen,

That does indeed seem very much worth documenting, thanks. If you or anyone else wants to submit a PR with this explanation (basically a verbatim quotation of what you've written would be great), I would happily accept it.

Thanks
-Wes

@steffex
Copy link
Contributor Author

steffex commented Mar 10, 2014

Hi Wes,

i'll add this to the documentation.

Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants