diff options
| author | Stanislav Malyshev <stas@php.net> | 2013-08-18 14:20:38 -0700 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2013-08-18 14:21:14 -0700 |
| commit | bf0c6f2858226d787bb8c7abe9d24a391df53d7a (patch) | |
| tree | 299c91e3d6dd386cbf83eca5e40136c9f42a31e5 /main | |
| parent | 1794291ebe02d7a1c5387c1d404a9022925f5b47 (diff) | |
| parent | 0154db1c5fcfd0c4030a0aefb2861dc8386b4a1c (diff) | |
| download | php-git-bf0c6f2858226d787bb8c7abe9d24a391df53d7a.tar.gz | |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
new for fix #65225
Fixed #65225: PHP_BINARY incorrectly set
Diffstat (limited to 'main')
| -rw-r--r-- | main/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c index e3b0e4332a..5942b23f72 100644 --- a/main/main.c +++ b/main/main.c @@ -114,6 +114,10 @@ #endif /* }}} */ +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions; #ifndef ZTS @@ -275,13 +279,14 @@ static void php_binary_init(TSRMLS_D) if ((envpath = getenv("PATH")) != NULL) { char *search_dir, search_path[MAXPATHLEN]; char *last = NULL; + struct stat s; path = estrdup(envpath); search_dir = php_strtok_r(path, ":", &last); while (search_dir) { snprintf(search_path, MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location); - if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK)) { + if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK) && VCWD_STAT(binary_location, &s) == 0 && S_ISREG(s.st_mode)) { found = 1; break; } |
