You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encountered an installation where a chartset other than UTF8 was used which was causing problems with get_option() (using maybe_unserialize()) from WordPress. The serialized string wasn't correct anymore and returned false causing DB storage not to function properly anymore.
Look into how to convert to JSON:
Find possible issues with older PHP versions
maybe_json_decode method (see below) = PHP 5.3+ > major release only
Other possible issues?
/** * Check if the string is JSON and decode it if so. * @link https://stackoverflow.com/questions/6041741/fastest-way-to-check-if-a-string-is-json-in-php * @param string $string * @param bool $assoc * @return array|mixed|object */publicstaticfunctionmaybe_json_decode( $string, $assoc = true ) {
if ( ! $string || ! is_string( $string ) ) {
return$string;
}
if ( 0 !== strpos( $string, '[' ) && 0 !== strpos( $string, '{' ) ) {
return$string;
}
$var = json_decode( $string, $assoc );
if ( JSON_ERROR_NONE === json_last_error() ) {
return$var;
}
return$string;
}
The text was updated successfully, but these errors were encountered:
Encountered an installation where a chartset other than
UTF8
was used which was causing problems withget_option()
(usingmaybe_unserialize()
) from WordPress. The serialized string wasn't correct anymore and returned false causing DB storage not to function properly anymore.Look into how to convert to JSON:
maybe_json_decode
method (see below) = PHP 5.3+ > major release onlyThe text was updated successfully, but these errors were encountered: