Never return empty map

This commit is contained in:
andryyy 2017-03-04 00:23:38 +01:00
parent 211e4158a2
commit 8c2416b711
2 changed files with 38 additions and 26 deletions

View File

@ -9,6 +9,7 @@ $opt = [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
$pdo = new PDO($dsn, $database_user, $database_pass, $opt);
$stmt = $pdo->query("SELECT `domain` FROM `domain`");
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -25,4 +26,9 @@ while ($row = array_shift($rows)) {
if ($has_object == 0) {
echo "dummy@domain.local";
}
}
catch (PDOException $e) {
echo "dummy@domain.local";
exit;
}
?>

View File

@ -9,6 +9,7 @@ $opt = [
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
$pdo = new PDO($dsn, $database_user, $database_pass, $opt);
$stmt = $pdo->query("SELECT `username` FROM `mailbox` WHERE `wants_tagged_subject` = '1'");
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -25,4 +26,9 @@ while ($row = array_shift($rows)) {
if ($has_object == 0) {
echo "dummy@domain.local";
}
}
catch (PDOException $e) {
echo "dummy@domain.local";
exit;
}
?>