Skip to content

Update ext/posix parameter names #6275

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 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ext/posix/posix.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/** @generate-function-entries */

function posix_kill(int $pid, int $sig): bool {}
function posix_kill(int $pid, int $signal): bool {}

function posix_getpid(): int {}

Expand Down Expand Up @@ -70,14 +70,14 @@ function posix_isatty($fd): bool {}
function posix_getcwd(): string|false {}

#ifdef HAVE_MKFIFO
function posix_mkfifo(string $pathname, int $mode): bool {}
function posix_mkfifo(string $filename, int $permissions): bool {}
#endif

#ifdef HAVE_MKNOD
function posix_mknod(string $pathname, int $mode, int $major = 0, int $minor = 0): bool {}
function posix_mknod(string $filename, int $flags, int $major = 0, int $minor = 0): bool {}
#endif

function posix_access(string $file, int $mode = 0): bool {}
function posix_access(string $file, int $flags = 0): bool {}

function posix_getgrnam(string $name): array|false {}

Expand All @@ -92,16 +92,16 @@ function posix_getrlimit(): array|false {}
#endif

#ifdef HAVE_SETRLIMIT
function posix_setrlimit(int $resource, int $softlimit, int $hardlimit): bool {}
function posix_setrlimit(int $resource, int $soft_limit, int $hard_limit): bool {}
#endif

function posix_get_last_error(): int {}

/** @alias posix_get_last_error */
function posix_errno(): int {}

function posix_strerror(int $errno): string {}
function posix_strerror(int $error_code): string {}

#ifdef HAVE_INITGROUPS
function posix_initgroups(string $name, int $base_group_id): bool {}
function posix_initgroups(string $username, int $base_group_id): bool {}
Copy link
Member

Choose a reason for hiding this comment

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

Does $base_group_id really require the $base prefix? What about just $gid to make it consistent with the rest of the parameters?

Copy link
Member Author

Choose a reason for hiding this comment

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

Man page says:

   The  initgroups() function initializes the group access list by reading the group database
  /etc/group and using all groups of which user is a member.  The additional group group  is
  also added to the list.

So yeah, I have no idea what the base_ prefix is even supposed to mean, I'll drop it.

#endif
22 changes: 11 additions & 11 deletions ext/posix/posix_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: c97ecb9b83ed873ca1ee2046ade191eef5bff25b */
* Stub hash: c0fc9487fd4b2de900ed66e77c8d6f14747c8a7a */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, sig, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, signal, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_getpid, 0, 0, IS_LONG, 0)
Expand Down Expand Up @@ -96,23 +96,23 @@ ZEND_END_ARG_INFO()

#if defined(HAVE_MKFIFO)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mkfifo, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, permissions, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif

#if defined(HAVE_MKNOD)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mknod, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, major, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, minor, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_access, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgrnam, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
Expand All @@ -139,8 +139,8 @@ ZEND_END_ARG_INFO()
#if defined(HAVE_SETRLIMIT)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setrlimit, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, resource, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, softlimit, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, hardlimit, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, soft_limit, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, hard_limit, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif

Expand All @@ -149,12 +149,12 @@ ZEND_END_ARG_INFO()
#define arginfo_posix_errno arginfo_posix_getpid

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_strerror, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0)
ZEND_END_ARG_INFO()

#if defined(HAVE_INITGROUPS)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_initgroups, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, base_group_id, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ function fwrite($stream, string $data, ?int $max_length = null): int|false {}
function fputs($stream, string $data, ?int $max_length = null): int|false {}

/** @param resource|null $context */
function mkdir(string $directory, int $mode = 0777, bool $recursive = false, $context = null): bool {}
function mkdir(string $directory, int $permissions = 0777, bool $recursive = false, $context = null): bool {}

/** @param resource|null $context */
function rename(string $from, string $to, $context = null): bool {}
Expand Down Expand Up @@ -922,7 +922,7 @@ function lchown(string $filename, string|int $user): bool {}
function lchgrp(string $filename, string|int $group): bool {}
#endif

function chmod(string $filename, int $mode): bool {}
function chmod(string $filename, int $permissions): bool {}

#if HAVE_UTIME
function touch(string $filename, ?int $mtime = null, ?int $atime = null): bool {}
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/basic_functions_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 1b9d82b77bd589dc95f5f4db1780162ee92c89c6 */
* Stub hash: bb98cb703c3ad25c11d21ee7b159acda93677cc3 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
Expand Down Expand Up @@ -1275,7 +1275,7 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mkdir, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0777")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, permissions, IS_LONG, 0, "0777")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, recursive, _IS_BOOL, 0, "false")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -1422,7 +1422,7 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chmod, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, permissions, IS_LONG, 0)
ZEND_END_ARG_INFO()

#if HAVE_UTIME
Expand Down
16 changes: 8 additions & 8 deletions ext/standard/tests/file/006_variation2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ bool(true)
bool(true)
43567
-- Iteration 12 --
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
-- Iteration 13 --
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
-- Iteration 14 --
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
-- Iteration 15 --
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($mode) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
chmod(): Argument #2 ($permissions) must be of type int, string given
*** Done ***