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
base: 2.4.x
Are you sure you want to change the base?
Conversation
Signed-off-by: tck <toby3@gmx.de>
Signed-off-by: tck <toby3@gmx.de>
if (null === $this->cacheDir) { | ||
$this->setCacheDir(null); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 TMPDIR
environment variable works:
putenv('TMPDIR=/fasel')
.
Edit:
Seems like putenv('TMPDIR=/fasel')
will also not work in the phpunit context.
There was a problem hiding this comment.
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?
Any update on this topic? In my opinion the |
Once the requested changes are applied, we can move on. |
I stumbled about this problem during a I came up with the same fix as @tck. Building a reproducer as phpunit testcase is tricky because A standalone reproducer looks like the following: <?php
require __DIR__ . '/vendor/autoload.php';
putenv('TMPDIR=/fasel');
// the following will throw an exception bacause `/fasel` does not exists even though the cache dir was explicitly overwritten
new \Laminas\Cache\Storage\Adapter\FilesystemOptions(['cacheDir' => '/tmp']);
If nobodoy has an idea how to codify the reproducer in phpunit I would suggest to move on and merge the PR as is. |
Might be possible to modify the We could create a test, add a group to it, use that group in The check in the test could look like: if (is_writable(sys_get_temp_dir())) {
self::markAsRisky();
self::markTestSkipped('Test has to be executed in read-only environment...');
} Here is an example on how |
No description provided.