In previous versions keys and IVs were padded with '\0' bytes to the next valid size which is not in the later versions. Try the following solutions -
1) Pad the key with "\0" which previous versions were doing for you
$key=$key."\0";
2) in case option 1 does not work try the following functions
function pad_key($key){
// key is too large
if(strlen($key) > 32) return false;
// set sizes
$sizes = array(16,24,32);
// loop through sizes and pad key
foreach($sizes as $s){
while(strlen($key) < $s) $key = $key."\0";
if(strlen($key) == $s) break; // finish if the key matches a size
}
// return
return $key;
}