Skip to content

Fix GH-18281: making flock flags mutually exclusive. #18315

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devnexen
Copy link
Member

proposing a standard way to detect bitwise values through a new Zend entry.

static inline bool php_is_valid_flock_flag(zend_long s) {
const zend_long sb = s & ~PHP_LOCK_NB;
return (sb == PHP_LOCK_UN || sb == PHP_LOCK_SH ||
sb == PHP_LOCK_EX || s == -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is -1?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems to be an accepted value (a test uses it) even tough it does nothing. I may discard it.

Copy link
Contributor

Choose a reason for hiding this comment

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

In my understanding -1 flag implies all flags set, thus more than 1 exclusive flag set, thus it should not be allowed and hence this PR.

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

Successfully merging this pull request may close these issues.

2 participants