Skip to content

Commit 4e441b1

Browse files
committed
Remove the "getdir" function which was introduced accidentally
The actual name of this function is dir(), but ever since it was introduced in PHP 3, its internal name was "getdir", leading to it being mistaken for an alias. This went unnoticed until the switch to stubs for generating arginfo, at which point getdir() became a real but undocumented function.
1 parent 7f4784c commit 4e441b1

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

ext/standard/basic_functions.stub.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,7 @@ function utf8_decode(string $string): string {}
695695
*/
696696
function opendir(string $directory, $context = null) {}
697697

698-
/** @param resource $context */
699-
function getdir(string $directory, $context = null): Directory|false {}
700-
701-
/**
702-
* @param resource|null $context
703-
* @alias getdir
704-
*/
698+
/** @param resource|null $context */
705699
function dir(string $directory, $context = null): Directory|false {}
706700

707701
/** @param resource|null $dir_handle */

ext/standard/basic_functions_arginfo.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 39cd1ddd82efd6b62605218faff8b720d8b97170 */
2+
* Stub hash: b1d68b2f2dcc7a078257c65569f2eec284dcd804 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -1094,13 +1094,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1)
10941094
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
10951095
ZEND_END_ARG_INFO()
10961096

1097-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_getdir, 0, 1, Directory, MAY_BE_FALSE)
1097+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_dir, 0, 1, Directory, MAY_BE_FALSE)
10981098
ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
10991099
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
11001100
ZEND_END_ARG_INFO()
11011101

1102-
#define arginfo_dir arginfo_getdir
1103-
11041102
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closedir, 0, 0, IS_VOID, 0)
11051103
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, dir_handle, "null")
11061104
ZEND_END_ARG_INFO()
@@ -2512,7 +2510,7 @@ ZEND_FUNCTION(substr_compare);
25122510
ZEND_FUNCTION(utf8_encode);
25132511
ZEND_FUNCTION(utf8_decode);
25142512
ZEND_FUNCTION(opendir);
2515-
ZEND_FUNCTION(getdir);
2513+
ZEND_FUNCTION(dir);
25162514
ZEND_FUNCTION(closedir);
25172515
ZEND_FUNCTION(chdir);
25182516
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
@@ -3147,8 +3145,7 @@ static const zend_function_entry ext_functions[] = {
31473145
ZEND_FE(utf8_encode, arginfo_utf8_encode)
31483146
ZEND_FE(utf8_decode, arginfo_utf8_decode)
31493147
ZEND_FE(opendir, arginfo_opendir)
3150-
ZEND_FE(getdir, arginfo_getdir)
3151-
ZEND_FALIAS(dir, getdir, arginfo_dir)
3148+
ZEND_FE(dir, arginfo_dir)
31523149
ZEND_FE(closedir, arginfo_closedir)
31533150
ZEND_FE(chdir, arginfo_chdir)
31543151
#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC

ext/standard/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ PHP_FUNCTION(opendir)
237237
/* }}} */
238238

239239
/* {{{ Directory class with properties, handle and class and methods read, rewind and close */
240-
PHP_FUNCTION(getdir)
240+
PHP_FUNCTION(dir)
241241
{
242242
_php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
243243
}

0 commit comments

Comments
 (0)