Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Safe Directory Names #134

Closed
nusphere opened this issue Jul 14, 2016 · 0 comments · Fixed by #135
Closed

Type Safe Directory Names #134

nusphere opened this issue Jul 14, 2016 · 0 comments · Fixed by #135

Comments

@nusphere
Copy link

nusphere commented Jul 14, 2016

Hi,

i found a bug, which occures when a directory name is given as integer.

$projectId = 80;
$this->vfsRoot->addChild(vfsStream::newDirectory($projectId);

This will register a directory child with the name "(int)80" - but the internal comparison use an splitted part of an path-url. This is an string, of course.

so your following comparison fails.

// vfsStreamDirectory:179
if ($child->getName() === $childName) {
     return $child;
}

Workaround:

$projectId = 80;
$this->vfsRoot->addChild(vfsStream::newDirectory("{$projectId}");

Fix:
You should safe the name of a directory as a string

mikey179 added a commit that referenced this issue Jul 18, 2016
Bugfix #134 - save names of childrens as string (type safe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant