Session data migration from Zend to Laminas

Hi

We’re about to migrate our applications using laminas-migration. Many thanks for providing this tool to the authors.

For deployment to production, we aim to keep login states of logged-in users. We’re using zend-session at the moment. All session files, are prefixed with __ZF while laminas-session will use __LAMINAS while the source does not seem to be backwards compatible at a quick glance. The content of each session file itself also carries references to Zend which needs replacement.

Is this something which has been adressed before with a tool?

Regards
Fabian

For our use case (the session files are configured to reside on a file system), the following bash script does the job and a user stays loggedin after the tool laminas-migration has been used.

#!/bin/bash

# NOTE: run directly in sessions folder!

# create backup of original session files
backup=sessions.zip
if [ ! -f "$backup" ]
then
  zip $backup sess_*
fi

# rewrite sessions
for session in `ls sess_*`
do
  sed -i -e 's/__ZF|/__Laminas|/' $session
  sed -i -e 's/Zend_Auth|/Laminas_Auth|/g' $session
done