Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

devnexen
Copy link
Member

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.

Comment on lines 730 to 734
path = expand_filepath(filename, NULL);
if (!path) {
POSIX_G(last_error) = EIO;
RETURN_FALSE;
}
Copy link
Member

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.

@devnexen devnexen force-pushed the posix_eaccess branch 2 times, most recently from 3c65cc6 to 84c17ac Compare March 26, 2023 15:23

path = expand_filepath(filename, NULL);
if (!path) {
zend_argument_value_error(1, "cannot be empty");
Copy link
Member

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?

Suggested change
zend_argument_value_error(1, "cannot be empty");
zend_argument_value_error(1, "must not be empty");

Copy link
Member

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.
@devnexen devnexen closed this in 2b35431 Mar 27, 2023
<?php

try {
posix_eaccess(str_repeat('bogus path', 1042));
Copy link
Member

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)
Copy link
Member

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?

llaville added a commit to llaville/php-compatinfo-db that referenced this pull request Oct 11, 2023
llaville added a commit to llaville/php-compatinfo-db that referenced this pull request Nov 18, 2023
llaville added a commit to llaville/php-compatinfo-db that referenced this pull request Nov 23, 2023
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.

3 participants