added escape parameters to fputcsv to satisfy php 8.4 Depracations

This commit is contained in:
johnnyq
2025-09-09 17:45:09 -04:00
parent d4167f9595
commit e4a437f54c
14 changed files with 60 additions and 30 deletions

View File

@@ -266,6 +266,8 @@ if (isset($_POST['export_users_csv'])) {
if ($count > 0) {
$delimiter = ",";
$enclosure = '"';
$escape = '\\'; // backslash
$filename = "Users-" . date('Y-m-d') . ".csv";
//create a file pointer
@@ -273,7 +275,7 @@ if (isset($_POST['export_users_csv'])) {
//set column headers
$fields = array('Name', 'Email', 'Role', 'Status', 'Creation Date');
fputcsv($f, $fields, $delimiter);
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
//output each row of the data, format line as csv and write to file pointer
while($row = $sql->fetch_assoc()) {
@@ -288,7 +290,7 @@ if (isset($_POST['export_users_csv'])) {
}
$lineData = array($row['user_name'], $row['user_email'], $row['role_name'], $user_status_display, $row['user_created_at']);
fputcsv($f, $lineData, $delimiter);
fputcsv($f, $lineData, $delimiter, $enclosure, $escape);
}
//move back to beginning of file