fixed error with unserialization of option

This commit is contained in:
asus
2024-03-31 17:59:17 +02:00
parent 7ad01a51ba
commit 3e2174a23f
3 changed files with 18 additions and 36 deletions

View File

@@ -1076,11 +1076,26 @@ class Plgntls_xtx {
return;
}
/*
* get option
* try to unserialize it
* if unserialization failed, it means it was not serialized
* - unserialize returns false if cannot unserialize,
* - which can also means it unserialized successfully the value 'false'
* - so checking for this special case with the serialized value of 'false'
*
*/
$option_data = get_option($option_name);
if (!is_string($option_data)) {
$option_data = serialize($option_data);
$false_serialized = serialize(false);
$option_unserialized = @unserialize($option_data);
if ($option_unserialized === false && $option_data != $false_serialized) {
$ret_option = $option_data;
}
return $option_data;
else {
$ret_option = $options_unserialized;
}
return $ret_option;
}
public static function update_option_safe($option, $option_data) {

View File

@@ -18,7 +18,6 @@ if (!defined('ABSPATH')) {
class Xtxpatch {
const OPTION_REGISTER_EMAIL = [
'_name'=>'define_email_at_register_xtxpatch',
'_callback'=>__NAMESPACE__.'\define_register_email',
'_default'=>[
'email'=>
'Bonjour,