Reorder array checks

Make sure that `if (isset($arr['__phpseclib_marker']))` is done on an array only.
This commit is contained in:
Joey3000 2016-02-16 20:45:05 +01:00
parent 062aa41ba0
commit 94b669d7ed

View File

@ -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) {