-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
should error, as a sql error occurs when ids
is an empty-array.
// should error
function inIDs(array $ids) {
$pdo->query('SELECT email FROM ada WHERE adaid IN('. implode(',', $ids) .')', PDO::FETCH_ASSOC);
}
// should error
function inIDs(array $ids) {
$stmt = $pdo->prepare('SELECT email FROM ada WHERE adaid IN(?)');
$stmt->execute([implode(',', $ids)]);
}
// fine
/** @param non-empty-array $ids */
function inIDs(array $ids) {
$pdo->query('SELECT email FROM ada WHERE adaid IN('. implode(',', $ids) .')', PDO::FETCH_ASSOC);
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request