Skip to content

Commit e08c0ed

Browse files
committed
Bug #74815 crash with a combination of INI entries at startup
TS related VCWD routines depend on CWD. Thus, a premature CWD deactivation renders the VCWD layer unusable. Same issue seems to persist in versions < 7.2, just that the code path is actually unused so the issue didn't show up. Still might make sense to backport this into lower branches.
1 parent c0be77a commit e08c0ed

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

Zend/zend.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,9 @@ void zend_post_startup(void) /* {{{ */
888888
}
889889
free(EG(zend_constants));
890890

891-
virtual_cwd_deactivate();
892-
893891
executor_globals_ctor(executor_globals);
894892
global_persistent_list = &EG(persistent_list);
895893
zend_copy_ini_directives();
896-
#else
897-
virtual_cwd_deactivate();
898894
#endif
899895
}
900896
/* }}} */

main/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
23592359
} zend_end_try();
23602360
}
23612361

2362+
virtual_cwd_deactivate();
2363+
23622364
sapi_deactivate();
23632365
module_startup = 0;
23642366

tests/output/bug74815.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #74815 crash with a combination of INI entries at startup
3+
--FILE--
4+
<?php
5+
6+
$php = getenv("TEST_PHP_EXECUTABLE");
7+
8+
echo shell_exec("$php -n -d error_log=errors.log -d error_reporting=E_ALL -d log_errors=On -d track_errors=On -v");
9+
10+
?>
11+
==DONE==
12+
--EXPECTF--
13+
Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
14+
%A
15+
==DONE==

0 commit comments

Comments
 (0)