Skip to content

Commit

Permalink
Prevent system warning when creating config_inc.php
Browse files Browse the repository at this point in the history
Due to the same root cause as issue #27796, the `@` operator does not
suppress the error.

Instead of suppressing the error, check whether the parent directory is
writable before calling fopen().
  • Loading branch information
dregad committed Dec 30, 2020
1 parent 67e707e commit 328f220
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion admin/install.php
Expand Up @@ -1249,7 +1249,10 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
$t_write_failed = true;

if( !$t_config_exists ) {
if( $t_fd = @fopen( $t_config_filename, 'w' ) ) {
# Try to create the config file
if( is_writable( $g_config_path )
&& $t_fd = fopen( $t_config_filename, 'w' )
) {
fwrite( $t_fd, $t_config );
fclose( $t_fd );
}
Expand Down

0 comments on commit 328f220

Please sign in to comment.