How to run Ossn releases older than ossn-v5.2-1582846048 on PHP 7.4

We became aware that 2 PHP functions used by former Ossn releases are no longer available with PHP 7.4

Our recommended solution is to update your Ossn to the latest version
- BEFORE switching to PHP 7.4

If you don't want to update your outdated Ossn for whatever reason, you need to apply 2 fixes this way:

  • Log in to your site with FTP or a similar file transfer utility
  • enter the subdirectory named libraries
  • copy the file named ossn.lib.system.php to your local PC
  • make a local backup of ossn.lib.system.php as ossn.lib.system.php.BAK
  • Use a simple text-editor like Notepad++ and open ossn.lib.system.php on your PC
  • Scroll down to line 726 to find the following block of code

function ossn_string_encrypt($string = '', $key = '') {
if (empty($string)) {
    return false;
}
if (empty($key)) {
    $key = ossn_site_settings('site_key');
}

$key    = ossn_string_encrypt_key_cycled($key);
//string also need to be at least 16 bytes
$string = utf8_encode($string);
if (strlen($string) % 8) {
    $string = str_pad($string, strlen($string) + 8 - strlen($string) % 8, "\0");
}

$size    = openssl_cipher_iv_length('bf-ecb');
$mcgetvi = openssl_random_pseudo_bytes($size);
return trim(openssl_encrypt($string, "bf-ecb", $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $mcgetvi)); 
}

  • delete this block completely and replace it by

function ossn_string_encrypt($string = '', $key = '') {
if (empty($string)) {
    return false;
}
if (strlen($string) % 8) {
    $string = str_pad($string, strlen($string) + 8 - strlen($string) % 8, "\0");
}
if (empty($key)) {
    $key = ossn_site_settings('site_key');
}
$key    = ossn_string_encrypt_key_cycled($key);
return openssl_encrypt($string, "bf-ecb", $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING);
}   

  • scroll down a little further until you see

function ossn_string_decrypt($string = '', $key = '') {
if (empty($string)) {
    return false;
}
if (empty($key)) {
    $key = ossn_site_settings('site_key');
}
$key = ossn_string_encrypt_key_cycled($key);

$size    = openssl_cipher_iv_length('bf-ecb');
$mcgetvi = openssl_random_pseudo_bytes($size);
//note mcrypt and now this acting mcrpyt adds the spaces to make 16 bytes if its less then 16 bytes
//you can use trim() to get orignal data without spaces
return openssl_decrypt($string, "bf-ecb", $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $mcgetvi);
      }

  • delete this block completely and replace it by

function ossn_string_decrypt($string = '', $key = '') {
if (empty($string)) {
    return false;
}
if (empty($key)) {
    $key = ossn_site_settings('site_key');
}
$key = ossn_string_encrypt_key_cycled($key);
return trim(openssl_decrypt($string, "bf-ecb", $key, OPENSSL_RAW_DATA  | OPENSSL_NO_PADDING));
      }

  • save your changes, leave the editor and copy ossn.lib.system.php back to your site