We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 735ca88 commit bd08a4aCopy full SHA for bd08a4a
resources/lib/UnitySQL.php
@@ -1,6 +1,7 @@
1
<?php
2
3
namespace UnityWebPortal\lib;
4
+use Exception;
5
6
use PDO;
7
@@ -278,8 +279,14 @@ public function getSiteVar($name)
278
279
$stmt->bindParam(":name", $name);
280
281
$stmt->execute();
-
282
- return $stmt->fetchAll()[0]['value'];
+ $result = $stmt->fetchAll();
283
+ if (empty($result)) {
284
+ throw new Exception("Site variable with name '$name' not found.");
285
+ }
286
+ if (count($result) > 1) {
287
+ throw new Exception("Multiple site variables found with name '$name'. Expected only one.");
288
289
+ return $result[0]['value'];
290
}
291
292
public function updateSiteVar($name, $value)
0 commit comments