Skip to content

Instantly share code, notes, and snippets.

@combatpoodle
Forked from scragg0x/gist:3894835
Created August 27, 2013 06:23
Show Gist options
  • Save combatpoodle/6350227 to your computer and use it in GitHub Desktop.
Save combatpoodle/6350227 to your computer and use it in GitHub Desktop.
def unserialize_session(val):
if not val:
return
session = {}
groups = re.split("([a-zA-Z0-9_]+)\|", val)
if len(groups) > 2:
groups = groups[1:]
groups = map(None, *([iter(groups)] * 2))
for i in range(len(groups)):
session[groups[i][0]] = phpserialize.loads(groups[i][1])
return session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment