Skip to content

Commit 97cb81e

Browse files
committed
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.
1 parent 5a09b9f commit 97cb81e

10 files changed

+0
-22
lines changed

Zend/zend_virtual_cwd.c

-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@
6565
# include <winnt.h>
6666
#endif
6767

68-
#ifndef HAVE_REALPATH
69-
#define realpath(x,y) strcpy(y,x)
70-
#endif
71-
7268
#define VIRTUAL_CWD_DEBUG 0
7369

7470
#include "TSRM.h"

configure.ac

-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ nl_langinfo \
582582
poll \
583583
ptsname \
584584
putenv \
585-
realpath \
586585
rand_r \
587586
scandir \
588587
setitimer \

ext/opcache/Optimizer/zend_func_info.c

-2
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,7 @@ static const func_info_t func_infos[] = {
321321
F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING),
322322
F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
323323
F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
324-
#if HAVE_REALPATH || defined(ZTS)
325324
F1("realpath", MAY_BE_FALSE | MAY_BE_STRING),
326-
#endif
327325
F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
328326
FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
329327
F1("pack", MAY_BE_FALSE | MAY_BE_STRING),

ext/spl/spl_directory.c

-4
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
12841284
}
12851285
/* }}} */
12861286

1287-
#if HAVE_REALPATH || defined(ZTS)
12881287
/* {{{ proto string SplFileInfo::getRealPath()
12891288
Return the resolved path */
12901289
SPL_METHOD(SplFileInfo, getRealPath)
@@ -1325,7 +1324,6 @@ SPL_METHOD(SplFileInfo, getRealPath)
13251324
zend_restore_error_handling(&error_handling);
13261325
}
13271326
/* }}} */
1328-
#endif
13291327

13301328
/* {{{ proto SplFileObject SplFileInfo::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
13311329
Open the current file */
@@ -1900,9 +1898,7 @@ static const zend_function_entry spl_SplFileInfo_functions[] = {
19001898
SPL_ME(SplFileInfo, isDir, arginfo_class_SplFileInfo_isDir, ZEND_ACC_PUBLIC)
19011899
SPL_ME(SplFileInfo, isLink, arginfo_class_SplFileInfo_isLink, ZEND_ACC_PUBLIC)
19021900
SPL_ME(SplFileInfo, getLinkTarget, arginfo_class_SplFileInfo_getLinkTarget, ZEND_ACC_PUBLIC)
1903-
#if HAVE_REALPATH || defined(ZTS)
19041901
SPL_ME(SplFileInfo, getRealPath, arginfo_class_SplFileInfo_getRealPath, ZEND_ACC_PUBLIC)
1905-
#endif
19061902
SPL_ME(SplFileInfo, getFileInfo, arginfo_class_SplFileInfo_getFileInfo, ZEND_ACC_PUBLIC)
19071903
SPL_ME(SplFileInfo, getPathInfo, arginfo_class_SplFileInfo_getPathInfo, ZEND_ACC_PUBLIC)
19081904
SPL_ME(SplFileInfo, openFile, arginfo_class_SplFileInfo_openFile, ZEND_ACC_PUBLIC)

ext/standard/basic_functions.c

-2
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
597597

598598
PHP_FALIAS(socket_get_status, stream_get_meta_data, arginfo_socket_get_status)
599599

600-
#if HAVE_REALPATH || defined(ZTS)
601600
PHP_FE(realpath, arginfo_realpath)
602-
#endif
603601

604602
#ifdef HAVE_FNMATCH
605603
PHP_FE(fnmatch, arginfo_fnmatch)

ext/standard/basic_functions.stub.php

-2
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,7 @@ function fputcsv($handle, array $fields, string $delimiter = ",", string $enclos
877877
/** @param resource $handle */
878878
function fgetcsv($handle, $length = UNKNOWN, string $delimiter = ",", string $enclosure = '"', string $escape = "\\"): array|false {}
879879

880-
#if HAVE_REALPATH || defined(ZTS)
881880
function realpath(string $path): string|false {}
882-
#endif
883881

884882
#ifdef HAVE_FNMATCH
885883
function fnmatch(string $pattern, string $filename, int $flags = 0): bool {}

ext/standard/basic_functions_arginfo.h

-2
Original file line numberDiff line numberDiff line change
@@ -1358,11 +1358,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgetcsv, 0, 1, MAY_BE_ARRAY|MAY_
13581358
ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
13591359
ZEND_END_ARG_INFO()
13601360

1361-
#if HAVE_REALPATH || defined(ZTS)
13621361
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_realpath, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
13631362
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
13641363
ZEND_END_ARG_INFO()
1365-
#endif
13661364

13671365
#if defined(HAVE_FNMATCH)
13681366
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fnmatch, 0, 2, _IS_BOOL, 0)

ext/standard/file.c

-2
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,6 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int
22932293
}
22942294
/* }}} */
22952295

2296-
#if HAVE_REALPATH || defined(ZTS)
22972296
/* {{{ proto string|false realpath(string path)
22982297
Return the resolved path */
22992298
PHP_FUNCTION(realpath)
@@ -2322,7 +2321,6 @@ PHP_FUNCTION(realpath)
23222321
}
23232322
}
23242323
/* }}} */
2325-
#endif
23262324

23272325
/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */
23282326
#define PHP_META_HTML401_CHARS "-_.:"

ext/standard/file.h

-2
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ PHP_FUNCTION(get_meta_tags);
5555
PHP_FUNCTION(flock);
5656
PHP_FUNCTION(fd_set);
5757
PHP_FUNCTION(fd_isset);
58-
#if HAVE_REALPATH || defined(ZTS)
5958
PHP_FUNCTION(realpath);
60-
#endif
6159
#ifdef HAVE_FNMATCH
6260
PHP_FUNCTION(fnmatch);
6361
#endif

win32/ioutil.h

-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ __forceinline static int php_win32_ioutil_link(const char *target, const char *l
630630
return ret;
631631
}/*}}}*/
632632

633-
#define HAVE_REALPATH 1
634633
PW32IO char *realpath(const char *path, char *resolved);
635634

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

0 commit comments

Comments
 (0)