Issue when using flock #126

Open
joshuaspence opened this Issue Dec 29, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@joshuaspence

I have an issue using vfsStream with code that calls flock. The issue is best explained by the following code example:

<?php

require __DIR__.'/vendor/autoload.php';

use org\bovigo\vfs\vfsStream;

$root = vfsStream::setUp();

$path = $root->url().'/x';
//$path = '/tmp/x';

$handle_one = fopen($path, 'a+');
$handle_two = fopen($path, 'a+');

$would_block = null;

flock($handle_one, LOCK_EX | LOCK_NB, $would_block);
var_dump($would_block);

flock($handle_two, LOCK_EX | LOCK_NB, $would_block);
var_dump($would_block);

Using vfsStream (i.e. $path = $root->url().'/x'), the output from this script is:

int(0)
int(0)

Using $path = '/tmp/x', the output from this script is:

int(0)
int(1)
@mikey179

This comment has been minimized.

Show comment
Hide comment
@mikey179

mikey179 Jan 6, 2016

Owner

I guess it is due to the fact the vfsStream doesn't block. It could be done, but currently it is not implemented. Also see #15.

Owner

mikey179 commented Jan 6, 2016

I guess it is due to the fact the vfsStream doesn't block. It could be done, but currently it is not implemented. Also see #15.

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