--- embedaddon/php/main/main.c 2013/07/22 01:32:11 1.1.1.3 +++ embedaddon/php/main/main.c 2013/10/14 08:02:43 1.1.1.4 @@ -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.4 2013/10/14 08:02:43 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 */ } /* }}} */