diff -up php-7.4.1/sapi/apache2handler/sapi_apache2.c.umask.droplet php-7.4.1/sapi/apache2handler/sapi_apache2.c --- php-7.4.1/sapi/apache2handler/sapi_apache2.c.umask.droplet 2019-12-17 17:35:58.000000000 +0100 +++ php-7.4.1/sapi/apache2handler/sapi_apache2.c 2020-01-08 22:26:12.858208748 +0100 @@ -499,6 +499,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; @@ -694,6 +707,9 @@ zend_first_try { highlight_file((char *)r->filename, &syntax_highlighter_ini); } else { zend_file_handle zfd; + + php_save_umask(); + zend_stream_init_filename(&zfd, (char *) r->filename); if (!parent_req) { @@ -702,6 +718,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))); }