I use codeigniter encryption lib for keep encoded company name. It is working with php 5.3. I upgrade my os to Ubuntu 14.04. So now my php version is 5.5. Old saved company names are not working. Same code and same DB is working in php 5.4 machine.
Old encrypted company name
$name = 'atQ1tmBTVcLV8ieDFCx/+RxHxj1CWXXyPYbPI/Q0Cxqe2piMqA/w3ze88199DwfP1L6CFA1MSUWedwD1z0gMmw=='
$company_name = $this->encrypt->decode($name);
echo $company_name; //result - ¾Ôf–s÷nŽ^¨H‡éêÁOðq‹û'É>Åì¦Ô—
But it works for newly created company. What is the issue?
According to @Damien My project lib use $this->_xor_decode($string, $key);
Not $this->mcrypt_encode($string, $key);
. Because php 5.5 in Ubuntu 14.04 has some issue with mcrypt.
I had fix it from this command.
sudo cp /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/
sudo service apache2 restart
It might be your new php installation doesn't have mcrypt library installed (or your new one has it, and the old didn't)
The encoding library checks if the extension is installed, and if not proceeds with its custom method:
if ($this->_mcrypt_exists === TRUE)
{
$enc = $this->mcrypt_encode($string, $key);
}
else
{
$enc = $this->_xor_encode($string, $key);
}
The reverse is the same: if you have mcrypt, it uses mycrypt_decode($data, $Key), else _xor_decode($string, $key). Try installing mcrypt
$ sudo apt-get install php5-mcrypt
And it should work. Or you could re-encode everything with the other system, but I suggest the former.
N.B. This is a guess, since you didn't tell (so far) if you have the extension (or if you didn't have it before) Nor you said your CI version, so I just browsed one I had on my server. But I'm fairly sure the reason is this)