Prechádzať zdrojové kódy

A couple of changes for the strictness of PHP 8

- Adding a explicit cast to a call of array_key_exists in the "custom fields" form, since PHP8 breaks the execution of the script because issues a fatal error when the implicit cast resolves to null, instead of issuing a warning like previous versions.
- Fixed a variable that was being referenced by the wrong name in mon_stats.php. This also breaks the execution in PHP8.
DieFeM 3 rokov pred
rodič
commit
65822a3637

+ 1 - 1
modules/server/mon_stats.php

@@ -24,7 +24,7 @@
 
 require_once('includes/lib_remote.php');
 function pretty_text_ttf($im, $fontsize, $angle, $x, $y, $color, $font, $string, $outline = false) {
-	$black  = imagecolorallocate($bgImg, 0, 0, 0);
+	$black  = imagecolorallocate($im, 0, 0, 0);
 
 	// Black outline
 	if($outline){

+ 1 - 1
modules/user_games/custom_fields.php

@@ -125,7 +125,7 @@ function exec_ogp_module()
 		$updatedSettings = array();
 		foreach($server_xml->custom_fields->field as $field)
 		{
-			if (array_key_exists((string)$field['key'], $custom_fields)){
+			if (array_key_exists((string)$field['key'], (array)$custom_fields)){
 				$origValue = (string)$custom_fields[(string)$field['key']];
 			}else{
 				$origValue = "";