mirror of
https://github.com/danog/tgseclib.git
synced 2025-01-22 05:51:20 +01:00
Fixing Uncaught Error: Cannot use object of type test as array
Refs https://github.com/phpseclib/phpseclib/pull/934/files#r53035721
This commit is contained in:
parent
6eb35eb42c
commit
062aa41ba0
@ -275,17 +275,19 @@ if (!function_exists('phpseclib_safe_serialize')) {
|
||||
if (is_object($arr)) {
|
||||
return '';
|
||||
}
|
||||
// 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) {
|
||||
// do not recurse on:
|
||||
// - the '__phpseclib_marker' key itself
|
||||
// - a circular reference (marked with that key)
|
||||
if ($key !== '__phpseclib_marker' && !isset($arr[$key]['__phpseclib_marker'])) {
|
||||
$safearr[$key] = is_array($arr[$key]) ? phpseclib_safe_serialize($arr[$key]) : $arr[$key];
|
||||
// do not recurse on the '__phpseclib_marker' key itself, for smaller memory usage
|
||||
if ($key !== '__phpseclib_marker') {
|
||||
$safearr[$key] = phpseclib_safe_serialize($arr[$key]);
|
||||
}
|
||||
}
|
||||
unset($arr['__phpseclib_marker']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user