--- embedaddon/php/main/main.c 2013/07/22 01:32:11 1.1.1.3 +++ embedaddon/php/main/main.c 2014/06/15 20:04:01 1.1.1.5 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.1.1.3 2013/07/22 01:32:11 misho Exp $ */ +/* $Id: main.c,v 1.1.1.5 2014/06/15 20:04:01 misho Exp $ */ /* {{{ includes */ @@ -115,6 +115,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 @@ -276,13 +280,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; } @@ -784,6 +789,9 @@ PHPAPI void php_verror(const char *docref, const char /* no docref given but function is known (the default) */ if (!docref && is_function) { int doclen; + while (*function == '_') { + function++; + } if (space[0] == '\0') { doclen = spprintf(&docref_buf, 0, "function.%s", function); } else { @@ -1523,7 +1531,7 @@ int php_request_startup(TSRMLS_D) int retval = SUCCESS; #ifdef HAVE_DTRACE - DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method)); + DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method)); #endif /* HAVE_DTRACE */ #ifdef PHP_WIN32 @@ -1833,7 +1841,7 @@ void php_request_shutdown(void *dummy) #endif #ifdef HAVE_DTRACE - DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), SAFE_FILENAME(SG(request_info).request_method)); + DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method)); #endif /* HAVE_DTRACE */ } /* }}} */