Skip to content

Commit

Permalink
Bug #74815 crash with a combination of INI entries at startup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weltling committed Jun 27, 2017
1 parent c0be77a commit e08c0ed
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 0 additions & 4 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,13 +888,9 @@ void zend_post_startup(void) /* {{{ */
}
free(EG(zend_constants));

virtual_cwd_deactivate();

executor_globals_ctor(executor_globals);
global_persistent_list = &EG(persistent_list);
zend_copy_ini_directives();
#else
virtual_cwd_deactivate();
#endif
}
/* }}} */
Expand Down
2 changes: 2 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
} zend_end_try();
}

virtual_cwd_deactivate();

sapi_deactivate();
module_startup = 0;

Expand Down
15 changes: 15 additions & 0 deletions tests/output/bug74815.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Bug #74815 crash with a combination of INI entries at startup
--FILE--
<?php

$php = getenv("TEST_PHP_EXECUTABLE");

echo shell_exec("$php -n -d error_log=errors.log -d error_reporting=E_ALL -d log_errors=On -d track_errors=On -v");

?>
==DONE==
--EXPECTF--
Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
%A
==DONE==

1 comment on commit e08c0ed

@SailorMax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weltling
Is this change can be the reason of the new problem with "./" in extension_dir setting? (for CLI scripts)
https://bugs.php.net/bug.php?id=74866

thank you.

Please sign in to comment.