Browse code

user/revres.php: fix Uncaught TypeError for PHP 8.x when trying to access an author review response to a nonexistent review - sub-issue is an Undefined variable warning when doing so as well

Clarissa Walker authored on 2026/11/01 18:53:29
Showing 1 changed files
... ...
@@ -73,7 +73,7 @@ if(!defined("_CHARSET")) exit( );
73 73
 			exit( );
74 74
 
75 75
 		}
76
-		$type = $reviews['type'];
76
+		$type = (isset($reviews['type']) ? $reviews['type'] : null);
77 77
 		if($type == "SE") $query2 = "SELECT uid FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '".$reviews['item']."'";
78 78
 		else if($type == "ST") {
79 79
 			$query2 = "SELECT uid, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '".$reviews['item']."' LIMIT 1";
... ...
@@ -84,7 +84,7 @@ if(!defined("_CHARSET")) exit( );
84 84
 				eval($code['code_text']);
85 85
 			}
86 86
 		}
87
-		$user = dbassoc(dbquery($query2));
87
+		$user = dbassoc(dbquery(isset($query2) ? $query2 : accessDenied()));
88 88
 		if(!empty($user['coauthors'])) {
89 89
 			$coQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '".$reviews['item']."'");
90 90
 			while($c = dbassoc($coQuery)) {