Skip to content

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

@bahamasbahamas

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);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions