MFH: Fixed bug #36630 (umask not reset at the end of the request).

This commit is contained in:
Ilia Alshanetsky 2006-05-14 16:06:48 +00:00
parent ad16c0a375
commit 4ab6eb3d19
4 changed files with 12 additions and 2 deletions

1
NEWS
View File

@ -39,6 +39,7 @@ PHP NEWS
- Fixed bug #37306 (max_execution_time = max_input_time). (Dmitry)
- Fixed bug #37244 (Added strict flag to base64_decode() that enforces
RFC3548 compliance). (Ilia)
- Fixed bug #36630 (umask not reset at the end of the request). (Ilia)
04 May 2006, PHP 5.1.4
- Added "capture_peer_cert" and "capture_peer_cert_chain" context options

View File

@ -944,6 +944,7 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC)
{
BG(rand_is_seeded) = 0;
BG(mt_rand_is_seeded) = 0;
BG(umask) = -1;
BG(next) = NULL;
BG(left) = -1;
@ -1217,6 +1218,10 @@ PHP_RSHUTDOWN_FUNCTION(basic)
zend_hash_destroy(&BG(putenv_ht));
#endif
if (BG(umask) != -1) {
umask(BG(umask));
}
/* Check if locale was changed and change it back
to the value in startup environment */
if (BG(locale_string) != NULL) {

View File

@ -215,6 +215,8 @@ typedef struct _php_basic_globals {
#if defined(_REENTRANT) && defined(HAVE_MBRLEN) && defined(HAVE_MBSTATE_T)
mbstate_t mblen_state;
#endif
int umask;
} php_basic_globals;
#ifdef ZTS

View File

@ -1464,6 +1464,10 @@ PHP_FUNCTION(umask)
oldumask = umask(077);
if (BG(umask) != -1) {
BG(umask) = oldumask;
}
if (arg_count == 0) {
umask(oldumask);
} else {
@ -1474,8 +1478,6 @@ PHP_FUNCTION(umask)
umask(Z_LVAL_PP(arg1));
}
/* XXX we should maybe reset the umask after each request! */
RETURN_LONG(oldumask);
}