fixed error with unserialization of option
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -46,38 +46,6 @@ function menu_content() {
|
||||
|
||||
|
||||
|
||||
function define_register_email($request, $option_name, $option_value) {
|
||||
/*
|
||||
* email
|
||||
*
|
||||
*/
|
||||
$email = '';
|
||||
if (isset($request['email'])) {
|
||||
$option_value['email'] = $request['email'];
|
||||
}
|
||||
|
||||
/*
|
||||
* is email ?
|
||||
*
|
||||
$is_email_prof = false;
|
||||
if (isset($post['is_email_prof']) && $post['is_email_prof'] === 'on') {
|
||||
$is_email_prof = true;
|
||||
}
|
||||
$is_email_partner = false;
|
||||
if (isset($post['is_email_partner']) && $post['is_email_partner'] === 'on') {
|
||||
$is_email_partner = true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* update the option with new values
|
||||
*
|
||||
*/
|
||||
// Plgntls_xtx::update_option_safe($option_name, $email);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user