Fix bind_param type mismatches and integer validation
- TemplateModel.php: fix bind_param "ssssiii" -> "sssssii" (5 strings not 4) - manage_workflows.php: fix bind_param 'ssiiii' -> 'ssiiiii' (4 int columns) - download_attachment.php, delete_attachment.php, get_template.php: replace is_numeric() with strict int cast+equality check to reject floats and scientific notation - manage_recurring.php: validate JSON input before accessing schedule_type key Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,16 +22,14 @@ if (!isset($_SESSION['user']) || !isset($_SESSION['user']['user_id'])) {
|
||||
}
|
||||
|
||||
// Get attachment ID
|
||||
$attachmentId = $_GET['id'] ?? null;
|
||||
if (!$attachmentId || !is_numeric($attachmentId)) {
|
||||
$attachmentId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
if ($attachmentId <= 0 || (string)$attachmentId !== (string)($_GET['id'] ?? '')) {
|
||||
http_response_code(400);
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => false, 'error' => 'Valid attachment ID is required']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$attachmentId = (int)$attachmentId;
|
||||
|
||||
try {
|
||||
$attachmentModel = new AttachmentModel(Database::getConnection());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user