--- php-7.0.1/sapi/apache2handler/sapi_apache2.c.umask.droplet 2015-12-16 11:41:54.000000000 +0100 +++ php-7.0.1/sapi/apache2handler/sapi_apache2.c 2015-12-29 00:40:11.502348482 +0100 @@ -475,6 +475,19 @@ static apr_status_t php_server_context_c return APR_SUCCESS; } +static int saved_umask; + +static void php_save_umask(void) +{ + saved_umask = umask(0777); + umask(saved_umask); +} + +static void php_restore_umask(void) +{ + umask(saved_umask); +} + static int php_apache_request_ctor(request_rec *r, php_struct *ctx) { char *content_length; @@ -669,6 +682,8 @@ zend_first_try { } else { zend_file_handle zfd; + php_save_umask(); + zfd.type = ZEND_HANDLE_FILENAME; zfd.filename = (char *) r->filename; zfd.free_filename = 0; @@ -680,6 +695,8 @@ zend_first_try { zend_execute_scripts(ZEND_INCLUDE, NULL, 1, &zfd); } + php_restore_umask(); + apr_table_set(r->notes, "mod_php_memory_usage", apr_psprintf(ctx->r->pool, "%" APR_SIZE_T_FMT, zend_memory_peak_usage(1))); }