summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-08-14 00:53:33 +0200
committerAnatol Belski <ab@php.net>2017-08-14 00:53:33 +0200
commitbeb9295790c32dde5364d8ce03dde7848641c7f1 (patch)
treeb6170bdbbfa01793002d60af3770d4c81905745d /Zend
parent9221bd7f325f93badd7f06289e6e2e2b821e5856 (diff)
parent0a2a136111a410c58c4cab10c69eafafcf827fa0 (diff)
downloadphp-git-beb9295790c32dde5364d8ce03dde7848641c7f1.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Fixed bug #75063
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend.c4
-rw-r--r--Zend/zend_virtual_cwd.c14
-rw-r--r--Zend/zend_virtual_cwd.h4
3 files changed, 20 insertions, 2 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index de7d52b0e3..46e4d5d8a5 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -717,6 +717,10 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
extern zend_php_scanner_globals language_scanner_globals;
#endif
+#ifdef ZEND_WIN32
+ php_win32_cp_set_by_id(65001);
+#endif
+
start_memory_manager();
virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 5ed84c3ecc..9afa406994 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -389,16 +389,21 @@ static void cwd_globals_dtor(virtual_cwd_globals *cwd_g) /* {{{ */
}
/* }}} */
-CWD_API void virtual_cwd_startup(void) /* {{{ */
+void virtual_cwd_main_cwd_init(uint8_t reinit) /* {{{ */
{
char cwd[MAXPATHLEN];
char *result;
+ if (reinit) {
+ free(main_cwd_state.cwd);
+ }
#ifdef ZEND_WIN32
ZeroMemory(&cwd, sizeof(cwd));
-#endif
+ result = php_win32_ioutil_getcwd(cwd, sizeof(cwd));
+#else
result = getcwd(cwd, sizeof(cwd));
+#endif
if (!result) {
cwd[0] = '\0';
@@ -411,7 +416,12 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
}
#endif
main_cwd_state.cwd = strdup(cwd);
+}
+/* }}} */
+CWD_API void virtual_cwd_startup(void) /* {{{ */
+{
+ virtual_cwd_main_cwd_init(0);
#ifdef ZTS
ts_allocate_id(&cwd_globals_id, sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
#else
diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h
index dc315e6df8..5e41fe2742 100644
--- a/Zend/zend_virtual_cwd.h
+++ b/Zend/zend_virtual_cwd.h
@@ -238,6 +238,10 @@ CWD_API zend_long realpath_cache_size(void);
CWD_API zend_long realpath_cache_max_buckets(void);
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
+#ifdef CWD_EXPORTS
+extern void virtual_cwd_main_cwd_init(uint8_t);
+#endif
+
/* The actual macros to be used in programs using TSRM
* If the program defines VIRTUAL_DIR it will use the
* virtual_* functions