Skip to content

traversalDir() method stores in $this->dir globaly #8

Description

@bahamasbahamas

Hey, if you call listSubdirs('/', true) in etcd/src/Client.php it works great but if you call listSubdirs('/', false) again you*ll get listSubdirs('/', true). I think the problem lives in traversalDir() method in etcd/src/Client.php. It stores in $this->dir globaly.

My quick fix would be:

    public function listSubdirs($key = '/', $recursive = false)
    {
        try {
            $data = $this->dirInfo($key, $recursive);
        } catch (EtcdException $e) {
            throw $e;
        }

        $iterator = new RecursiveArrayIterator($data);
	    
	//reset iterator array
        $this->dirs = [];

        return $this->traversalDir($iterator);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions