Skip to content

Make realpath() required #5290

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
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions Zend/zend_virtual_cwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
# include <winnt.h>
#endif

#ifndef HAVE_REALPATH
#define realpath(x,y) strcpy(y,x)
#endif

#define VIRTUAL_CWD_DEBUG 0

#include "TSRM.h"
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ nl_langinfo \
poll \
ptsname \
putenv \
realpath \
rand_r \
scandir \
setitimer \
Expand Down
2 changes: 0 additions & 2 deletions ext/opcache/Optimizer/zend_func_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ static const func_info_t func_infos[] = {
F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING),
F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
#if HAVE_REALPATH || defined(ZTS)
F1("realpath", MAY_BE_FALSE | MAY_BE_STRING),
#endif
F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pack", MAY_BE_FALSE | MAY_BE_STRING),
Expand Down
4 changes: 0 additions & 4 deletions ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
}
/* }}} */

#if HAVE_REALPATH || defined(ZTS)
/* {{{ proto string SplFileInfo::getRealPath()
Return the resolved path */
SPL_METHOD(SplFileInfo, getRealPath)
Expand Down Expand Up @@ -1323,7 +1322,6 @@ SPL_METHOD(SplFileInfo, getRealPath)
zend_restore_error_handling(&error_handling);
}
/* }}} */
#endif

/* {{{ proto SplFileObject SplFileInfo::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
Open the current file */
Expand Down Expand Up @@ -1924,9 +1922,7 @@ static const zend_function_entry spl_SplFileInfo_functions[] = {
SPL_ME(SplFileInfo, isDir, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, isLink, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, getLinkTarget, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
#if HAVE_REALPATH || defined(ZTS)
SPL_ME(SplFileInfo, getRealPath, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
#endif
SPL_ME(SplFileInfo, getFileInfo, arginfo_info_optinalFileClass, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, getPathInfo, arginfo_info_optinalFileClass, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, openFile, arginfo_info_openFile, ZEND_ACC_PUBLIC)
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,9 +597,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */

PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_socket_get_status)

#if HAVE_REALPATH || defined(ZTS)
PHP_FE(realpath, arginfo_realpath)
#endif

#ifdef HAVE_FNMATCH
PHP_FE(fnmatch, arginfo_fnmatch)
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,7 @@ function fputcsv($handle, array $fields, string $delimiter = ",", string $enclos
/** @param resource $handle */
function fgetcsv($handle, $length = UNKNOWN, string $delimiter = ",", string $enclosure = '"', string $escape = "\\"): array|false {}

#if HAVE_REALPATH || defined(ZTS)
function realpath(string $path): string|false {}
#endif

#ifdef HAVE_FNMATCH
function fnmatch(string $pattern, string $filename, int $flags = 0): bool {}
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/basic_functions_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1358,11 +1358,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgetcsv, 0, 1, MAY_BE_ARRAY|MAY_
ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
ZEND_END_ARG_INFO()

#if HAVE_REALPATH || defined(ZTS)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_realpath, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif

#if defined(HAVE_FNMATCH)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fnmatch, 0, 2, _IS_BOOL, 0)
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,6 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int
}
/* }}} */

#if HAVE_REALPATH || defined(ZTS)
/* {{{ proto string|false realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
Expand Down Expand Up @@ -2322,7 +2321,6 @@ PHP_FUNCTION(realpath)
}
}
/* }}} */
#endif

/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */
#define PHP_META_HTML401_CHARS "-_.:"
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset);
#if HAVE_REALPATH || defined(ZTS)
PHP_FUNCTION(realpath);
#endif
#ifdef HAVE_FNMATCH
PHP_FUNCTION(fnmatch);
#endif
Expand Down
1 change: 0 additions & 1 deletion win32/ioutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ __forceinline static int php_win32_ioutil_link(const char *target, const char *l
return ret;
}/*}}}*/

#define HAVE_REALPATH 1
PW32IO char *realpath(const char *path, char *resolved);

__forceinline static char *php_win32_ioutil_realpath_ex0(const char *path, char *resolved, PBY_HANDLE_FILE_INFORMATION info)
Expand Down