Fix $x was not initialized on first iteration of for loop (#6936)

This commit is contained in:
frytimo 2024-04-02 12:09:36 -03:00 committed by GitHub
parent d4b3d8682b
commit e47b2e3710
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -48,13 +48,12 @@ class sounds {
$database = new database;
$recordings = $database->select($sql, $parameters, 'all');
if (is_array($recordings) && @sizeof($recordings) != 0) {
foreach ($recordings as &$row) {
foreach ($recordings as $x => &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
$recording_path = !empty($this->full_path) && is_array($this->full_path) && in_array('recordings', $this->full_path) ? $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/' : null;
$array['recordings'][$x]['name'] = $recording_name;
$array['recordings'][$x]['value'] = $recording_path.$recording_filename;
$x++;
}
}
unset($sql, $parameters, $recordings, $row);