diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index f28b180a..472d47c0 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -275,13 +275,13 @@ if (!function_exists('phpseclib_safe_serialize')) { if (is_object($arr)) { return ''; } + if (!is_array($arr)) { + return serialize($arr); + } // prevent circular array recursion if (isset($arr['__phpseclib_marker'])) { return ''; } - if (!is_array($arr)) { - return serialize($arr); - } $safearr = array(); $arr['__phpseclib_marker'] = true; foreach (array_keys($arr) as $key) {