-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/posix: proposing posix_eaccess. #10917
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
Conversation
ext/posix/posix.c
Outdated
path = expand_filepath(filename, NULL); | ||
if (!path) { | ||
POSIX_G(last_error) = EIO; | ||
RETURN_FALSE; | ||
} |
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.
Is this case the one where the path is empty? Maybe better to have a ValueError for this as this is a new function.
3c65cc6
to
84c17ac
Compare
ext/posix/posix.c
Outdated
|
||
path = expand_filepath(filename, NULL); | ||
if (!path) { | ||
zend_argument_value_error(1, "cannot be empty"); |
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 think our standard writing is as such. @kocsismate is this correct?
zend_argument_value_error(1, "cannot be empty"); | |
zend_argument_value_error(1, "must not be empty"); |
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.
No, the wording is somehow cannot be empty
:) We do have a couple of must not be empty
as well, but it's much less than the former one
unlike access, it is not standard but available in enough platforms ; on linux it's euidaccess in reality eaccess being 'just' an alias. key difference is eaccess checks the effective user id instead.
<?php | ||
|
||
try { | ||
posix_eaccess(str_repeat('bogus path', 1042)); |
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.
would it make sense to have a test for the happy path?
@@ -713,6 +713,44 @@ PHP_FUNCTION(posix_access) | |||
|
|||
RETURN_TRUE; | |||
} | |||
|
|||
#ifdef HAVE_EACCESS | |||
PHP_FUNCTION(posix_eaccess) |
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.
there should be an upgrading note added, right?
unlike access, it is not standard but available in enough platforms ; on linux it's euidaccess in reality eaccess being 'just' an alias. key difference is eaccess checks the effective user id instead.