summaryrefslogtreecommitdiff
path: root/Zend/zend_virtual_cwd.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-08-14 00:51:47 +0200
committerAnatol Belski <ab@php.net>2017-08-14 00:51:47 +0200
commit0a2a136111a410c58c4cab10c69eafafcf827fa0 (patch)
tree4e0fe8ce11413d71897002435c95722484fd55ae /Zend/zend_virtual_cwd.c
parent36eddfc785ad2db4293571eabb5fc5ac989bb8d8 (diff)
parent3069ad8dd1400f19a28230d3028048a27d07ce8d (diff)
downloadphp-git-0a2a136111a410c58c4cab10c69eafafcf827fa0.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed bug #75063
Diffstat (limited to 'Zend/zend_virtual_cwd.c')
-rw-r--r--Zend/zend_virtual_cwd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index e9ffda7cc3..3e95795b08 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