mirror of https://gitee.com/karson/fastadmin.git
修复当 $myid 为字符串类型时出现的无限递归的问题
由于 PHP 中 0 == 字符串永远等于 true 的特性,该处容易出现判断错误。 - 为什么不用 === 因为很多情况可能会搞不清当前数据是 0 还是 '0' ,使用类型转换更加兼容。pull/377/head
parent
edec9f7fe1
commit
077bba602d
|
|
@ -112,10 +112,10 @@ class Tree
|
|||
if (!isset($value['id'])) {
|
||||
continue;
|
||||
}
|
||||
if ($value[$this->pidname] == $myid) {
|
||||
if ((string)$value[$this->pidname] == (string)$myid) {
|
||||
$newarr[] = $value;
|
||||
$newarr = array_merge($newarr, $this->getChildren($value['id']));
|
||||
} elseif ($withself && $value['id'] == $myid) {
|
||||
} elseif ($withself && (string)$value['id'] == (string)$myid) {
|
||||
$newarr[] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue