-
Notifications
You must be signed in to change notification settings - Fork 473
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
Bleeding edge - More precise flock() operation flags #2477
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
|
||
class flock { | ||
/** @param resource $fp */ | ||
public function ok($fp):void { |
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.
code examples from https://www.php.net/manual/en/function.flock
@@ -108,6 +108,7 @@ | |||
'max' => ['', '...arg1'=>'non-empty-array'], | |||
'min' => ['', '...arg1'=>'non-empty-array'], | |||
'file' => ['list<string>|false', 'filename'=>'string', 'flags='=>'0|FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES', 'context='=>'resource'], | |||
'flock' => ['bool', 'fp'=>'resource', 'operation'=>'int-mask<1, 2, 4>', '&w_wouldblock='=>'int'], |
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.
semantically we can be more precise if we want. as not all combinations of the constants are allowed.
0
is not allowed.
combinations of e.g. LOCK_EX
and LOCK_SH
are not valid
not sure its worth it though
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.
Can you use the constants instead of numbers?
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.
it seems we do not yet support constants in int-mask
:
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.
ohh my bad: it works
bc4eed5
to
2316434
Compare
Thank you. |
No description provided.