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

pull request for issue #65 #73

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/FilesystemOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ public function __construct($options = null)
$this->dirPermission = false;
}

$this->setCacheDir(null);

parent::__construct($options);

if (null === $this->cacheDir) {
$this->setCacheDir(null);
}
Comment on lines +117 to +119
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some sort of test / reproducer, IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest creating a directory in that test, change permissions to read-only using chmod and pass that to ini_set to modify sys temp dir for that test.

Having something like try {} finally {} to restore temp dir back to default to ensure test does not introduce side-effects to other tests.

Copy link
Contributor

@bcremer bcremer Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys_temp_dir is of type PHP_INI_SYSTEM and thus cannot be set during runtime via ini_set.

Setting the TMPDIRenvironment variable works:
putenv('TMPDIR=/fasel').

Edit:
Seems like putenv('TMPDIR=/fasel') will also not work in the phpunit context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is a tmpdir only issue. Whenever a directory is used without write-permissions, that could lead to problems, no?

}

/**
Expand Down