| 
39 | 39 | 			echo("Powered by Pepperminty Wiki version $version+" . substr($commit, 0, 7) . ".\n");  | 
40 | 40 | 			echo("This report may contain personal information.\n\n");  | 
41 | 41 | 			echo("Environment: ");  | 
42 |  | -			echo(var_export($env, true));  | 
 | 42 | +			echo(debug_mask_secrets(var_export($env, true)));  | 
43 | 43 | 			echo("\nPaths: ");  | 
44 |  | -			var_dump(var_export($paths, true));  | 
 | 44 | +			echo(var_export($paths, true));  | 
45 | 45 | 			echo("\nServer information:\n");  | 
46 | 46 | 			echo("uname -a: " . php_uname() . "\n");  | 
47 | 47 | 			echo("Path: " . getenv("PATH") . "\n");  | 
 | 
56 | 56 | 			echo("Storage directory permissions: " . substr(sprintf('%o', fileperms($env->storage_prefix)), -4) . "\n");  | 
57 | 57 | 			echo("Loaded extensions: " . implode(", ", get_loaded_extensions()) . "\n");  | 
58 | 58 | 			echo("Settings:\n-----\n");  | 
59 |  | -			$settings_export = explode("\n", var_export($settings, true));  | 
60 |  | -			foreach ($settings_export as &$row)  | 
61 |  | -			{  | 
62 |  | -				if(preg_match("/'(secret|sitesecret|email(?:Address)?|password)'/i", $row)) $row = "********* secret *********";   | 
63 |  | -			}  | 
64 |  | -			echo(implode("\n", $settings_export));  | 
 | 59 | +			echo(debug_mask_secrets(var_export($settings, true)));  | 
65 | 60 | 			echo("\n-----\n");  | 
66 | 61 | 			exit();  | 
67 | 62 | 		});  | 
 | 
73 | 68 | 	}  | 
74 | 69 | ]);  | 
75 | 70 | 
 
  | 
 | 71 | +/**  | 
 | 72 | + * Masks secrets in debug output.  | 
 | 73 | + * @param  string $text The text to mask.  | 
 | 74 | + * @return string       The masked text.  | 
 | 75 | + */  | 
 | 76 | +function debug_mask_secrets($text) {  | 
 | 77 | +	$lines = explode("\n", $text);  | 
 | 78 | +	foreach ($lines as &$line) {  | 
 | 79 | +		if(preg_match("/'(secret|sitesecret|email(?:Address)?|password)'/i", $line)) $line = "********* secret *********";   | 
 | 80 | +	}  | 
 | 81 | +	  | 
 | 82 | +	return implode("\n", $lines);  | 
 | 83 | +}  | 
 | 84 | + | 
76 | 85 | ?>  | 
0 commit comments