@@ -712,7 +712,8 @@ PHP_INI_BEGIN()
712
712
STD_PHP_INI_ENTRY ("internal_encoding" , NULL , PHP_INI_ALL , OnUpdateInternalEncoding , internal_encoding , php_core_globals , core_globals )
713
713
STD_PHP_INI_ENTRY ("input_encoding" , NULL , PHP_INI_ALL , OnUpdateInputEncoding , input_encoding , php_core_globals , core_globals )
714
714
STD_PHP_INI_ENTRY ("output_encoding" , NULL , PHP_INI_ALL , OnUpdateOutputEncoding , output_encoding , php_core_globals , core_globals )
715
- STD_PHP_INI_ENTRY ("error_log" , NULL , PHP_INI_ALL , OnUpdateErrorLog , error_log , php_core_globals , core_globals )
715
+ STD_PHP_INI_ENTRY ("error_log" , NULL , PHP_INI_ALL , OnUpdateErrorLog , error_log , php_core_globals , core_globals )
716
+ STD_PHP_INI_ENTRY ("error_log_mode" , "0644" , PHP_INI_ALL , OnUpdateLong , error_log_mode , php_core_globals , core_globals )
716
717
STD_PHP_INI_ENTRY ("extension_dir" , PHP_EXTENSION_DIR , PHP_INI_SYSTEM , OnUpdateStringUnempty , extension_dir , php_core_globals , core_globals )
717
718
STD_PHP_INI_ENTRY ("sys_temp_dir" , NULL , PHP_INI_SYSTEM , OnUpdateStringUnempty , sys_temp_dir , php_core_globals , core_globals )
718
719
STD_PHP_INI_ENTRY ("include_path" , PHP_INCLUDE_PATH , PHP_INI_ALL , OnUpdateStringUnempty , include_path , php_core_globals , core_globals )
@@ -807,14 +808,23 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(const char *log_message, int sys
807
808
808
809
/* Try to use the specified logging location. */
809
810
if (PG (error_log ) != NULL ) {
811
+ int error_log_mode ;
812
+
810
813
#ifdef HAVE_SYSLOG_H
811
814
if (!strcmp (PG (error_log ), "syslog" )) {
812
815
php_syslog (syslog_type_int , "%s" , log_message );
813
816
PG (in_error_log ) = 0 ;
814
817
return ;
815
818
}
816
819
#endif
817
- fd = VCWD_OPEN_MODE (PG (error_log ), O_CREAT | O_APPEND | O_WRONLY , 0644 );
820
+
821
+ error_log_mode = 0644 ;
822
+
823
+ if (PG (error_log_mode ) > 0 && PG (error_log_mode ) <= 0777 ) {
824
+ error_log_mode = PG (error_log_mode );
825
+ }
826
+
827
+ fd = VCWD_OPEN_MODE (PG (error_log ), O_CREAT | O_APPEND | O_WRONLY , error_log_mode );
818
828
if (fd != -1 ) {
819
829
char * tmp ;
820
830
size_t len ;
0 commit comments