private function checkObjectRecursion($obj)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($obj, $dump, true)) {
            return true;
        }

        $dump[] = $obj;

        $return = false;

        $props = Reflexion::getReflectionProperties($obj);
        foreach ($props as $prop) {
            $val = Reflexion::get($obj, $prop->getName());
            if (is_array($val) && $this->checkArrayRecursion($val)) {
                $return = true;
                break;
            } elseif (is_object($val) && $this->checkObjectRecursion($val)) {
                $return = true;
                break;
            }
        }
        foreach ($obj as $val) {
            if (is_array($val) && $this->checkArrayRecursion($val)) {
                $return = true;
                break;
            } elseif (is_object($val) && $this->checkObjectRecursion($val)) {
                $return = true;
                break;
            }
        }

        array_pop($dump);

        return $return;
    }
private function checkObjectRecursion($obj)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($obj, $dump, true)) {
            return true;
        }

        $dump[] = $obj;

        $return = false;

        $props = Reflexion::getReflectionProperties($obj);
        foreach ($props as $prop) {
            $val = Reflexion::get($obj, $prop->getName());
            if (is_array($val) && $this->checkArrayRecursion($val)) {
                $return = true;
                break;
            } elseif (is_object($val) && $this->checkObjectRecursion($val)) {
                $return = true;
                break;
            }
        }
        foreach ($obj as $val) {
            if (is_array($val) && $this->checkArrayRecursion($val)) {
                $return = true;
                break;
            } elseif (is_object($val) && $this->checkObjectRecursion($val)) {
                $return = true;
                break;
            }
        }

        array_pop($dump);

        return $return;
    }
private function checkObjectRecursion ( $ obj ) { static $ dump ; if ( ! isset ( $ dump ) ) { $ dump = [ ] ; } if ( in_array ( $ obj , $ dump , true ) ) { return true ; } $ dump [ ] = $ obj ; $ return = false ; $ props = Reflexion :: getReflectionProperties ( $ obj ) ; foreach ( $ props as $ prop ) { $ val = Reflexion :: get ( $ obj , $ prop -> getName ( ) ) ; if ( is_array ( $ val ) && $ this -> checkArrayRecursion ( $ val ) ) { $ return = true ; break ; } elseif ( is_object ( $ val ) && $ this -> checkObjectRecursion ( $ val ) ) { $ return = true ; break ; } } foreach ( $ obj as $ val ) { if ( is_array ( $ val ) && $ this -> checkArrayRecursion ( $ val ) ) { $ return = true ; break ; } elseif ( is_object ( $ val ) && $ this -> checkObjectRecursion ( $ val ) ) { $ return = true ; break ; } } array_pop ( $ dump ) ; return $ return ; }
Check if an object contains any recursion

@param $obj

@return bool
Check if an object contains any recursion