summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/main/main.c b/main/main.c
index 7a253f8b2..1fd82c839 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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 *params, int type, const c
/* 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 */
}
/* }}} */
@@ -2070,6 +2078,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
EG(exception_class) = NULL;
PG(disable_functions) = NULL;
PG(disable_classes) = NULL;
+ EG(exception) = NULL;
+ EG(objects_store).object_buckets = NULL;
#if HAVE_SETLOCALE
setlocale(LC_CTYPE, "");