Remove HAVE_REALPATH checks

We do not actually use realpath(), but a custom implementation.
Make sure the realpath() function is always available.

Closes GH-5290.
This commit is contained in:
Nikita Popov 2020-03-23 10:18:00 +01:00
parent 5a09b9fb0f
commit 97cb81ead5
10 changed files with 0 additions and 22 deletions

View file

@ -65,10 +65,6 @@
# include <winnt.h> # include <winnt.h>
#endif #endif
#ifndef HAVE_REALPATH
#define realpath(x,y) strcpy(y,x)
#endif
#define VIRTUAL_CWD_DEBUG 0 #define VIRTUAL_CWD_DEBUG 0
#include "TSRM.h" #include "TSRM.h"

View file

@ -582,7 +582,6 @@ nl_langinfo \
poll \ poll \
ptsname \ ptsname \
putenv \ putenv \
realpath \
rand_r \ rand_r \
scandir \ scandir \
setitimer \ setitimer \

View file

@ -321,9 +321,7 @@ static const func_info_t func_infos[] = {
F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING), 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("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), 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), F1("realpath", MAY_BE_FALSE | MAY_BE_STRING),
#endif
F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE), F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE), FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pack", MAY_BE_FALSE | MAY_BE_STRING), F1("pack", MAY_BE_FALSE | MAY_BE_STRING),

View file

@ -1284,7 +1284,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
} }
/* }}} */ /* }}} */
#if HAVE_REALPATH || defined(ZTS)
/* {{{ proto string SplFileInfo::getRealPath() /* {{{ proto string SplFileInfo::getRealPath()
Return the resolved path */ Return the resolved path */
SPL_METHOD(SplFileInfo, getRealPath) SPL_METHOD(SplFileInfo, getRealPath)
@ -1325,7 +1324,6 @@ SPL_METHOD(SplFileInfo, getRealPath)
zend_restore_error_handling(&error_handling); zend_restore_error_handling(&error_handling);
} }
/* }}} */ /* }}} */
#endif
/* {{{ proto SplFileObject SplFileInfo::openFile([string mode = 'r' [, bool use_include_path [, resource context]]]) /* {{{ proto SplFileObject SplFileInfo::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
Open the current file */ Open the current file */
@ -1900,9 +1898,7 @@ static const zend_function_entry spl_SplFileInfo_functions[] = {
SPL_ME(SplFileInfo, isDir, arginfo_class_SplFileInfo_isDir, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, isDir, arginfo_class_SplFileInfo_isDir, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, isLink, arginfo_class_SplFileInfo_isLink, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, isLink, arginfo_class_SplFileInfo_isLink, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, getLinkTarget, arginfo_class_SplFileInfo_getLinkTarget, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, getLinkTarget, arginfo_class_SplFileInfo_getLinkTarget, ZEND_ACC_PUBLIC)
#if HAVE_REALPATH || defined(ZTS)
SPL_ME(SplFileInfo, getRealPath, arginfo_class_SplFileInfo_getRealPath, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, getRealPath, arginfo_class_SplFileInfo_getRealPath, ZEND_ACC_PUBLIC)
#endif
SPL_ME(SplFileInfo, getFileInfo, arginfo_class_SplFileInfo_getFileInfo, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, getFileInfo, arginfo_class_SplFileInfo_getFileInfo, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, getPathInfo, arginfo_class_SplFileInfo_getPathInfo, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, getPathInfo, arginfo_class_SplFileInfo_getPathInfo, ZEND_ACC_PUBLIC)
SPL_ME(SplFileInfo, openFile, arginfo_class_SplFileInfo_openFile, ZEND_ACC_PUBLIC) SPL_ME(SplFileInfo, openFile, arginfo_class_SplFileInfo_openFile, ZEND_ACC_PUBLIC)

View file

@ -597,9 +597,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_socket_get_status) PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_socket_get_status)
#if HAVE_REALPATH || defined(ZTS)
PHP_FE(realpath, arginfo_realpath) PHP_FE(realpath, arginfo_realpath)
#endif
#ifdef HAVE_FNMATCH #ifdef HAVE_FNMATCH
PHP_FE(fnmatch, arginfo_fnmatch) PHP_FE(fnmatch, arginfo_fnmatch)

View file

@ -877,9 +877,7 @@ function fputcsv($handle, array $fields, string $delimiter = ",", string $enclos
/** @param resource $handle */ /** @param resource $handle */
function fgetcsv($handle, $length = UNKNOWN, string $delimiter = ",", string $enclosure = '"', string $escape = "\\"): array|false {} function fgetcsv($handle, $length = UNKNOWN, string $delimiter = ",", string $enclosure = '"', string $escape = "\\"): array|false {}
#if HAVE_REALPATH || defined(ZTS)
function realpath(string $path): string|false {} function realpath(string $path): string|false {}
#endif
#ifdef HAVE_FNMATCH #ifdef HAVE_FNMATCH
function fnmatch(string $pattern, string $filename, int $flags = 0): bool {} function fnmatch(string $pattern, string $filename, int $flags = 0): bool {}

View file

@ -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_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
ZEND_END_ARG_INFO() 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_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_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#endif
#if defined(HAVE_FNMATCH) #if defined(HAVE_FNMATCH)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fnmatch, 0, 2, _IS_BOOL, 0) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fnmatch, 0, 2, _IS_BOOL, 0)

View file

@ -2293,7 +2293,6 @@ out:
} }
/* }}} */ /* }}} */
#if HAVE_REALPATH || defined(ZTS)
/* {{{ proto string|false realpath(string path) /* {{{ proto string|false realpath(string path)
Return the resolved path */ Return the resolved path */
PHP_FUNCTION(realpath) PHP_FUNCTION(realpath)
@ -2322,7 +2321,6 @@ PHP_FUNCTION(realpath)
} }
} }
/* }}} */ /* }}} */
#endif
/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */ /* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */
#define PHP_META_HTML401_CHARS "-_.:" #define PHP_META_HTML401_CHARS "-_.:"

View file

@ -55,9 +55,7 @@ PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock); PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set); PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset); PHP_FUNCTION(fd_isset);
#if HAVE_REALPATH || defined(ZTS)
PHP_FUNCTION(realpath); PHP_FUNCTION(realpath);
#endif
#ifdef HAVE_FNMATCH #ifdef HAVE_FNMATCH
PHP_FUNCTION(fnmatch); PHP_FUNCTION(fnmatch);
#endif #endif

View file

@ -630,7 +630,6 @@ __forceinline static int php_win32_ioutil_link(const char *target, const char *l
return ret; return ret;
}/*}}}*/ }/*}}}*/
#define HAVE_REALPATH 1
PW32IO char *realpath(const char *path, char *resolved); 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) __forceinline static char *php_win32_ioutil_realpath_ex0(const char *path, char *resolved, PBY_HANDLE_FILE_INFORMATION info)