Harden model populate methods

Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-24 12:57:05 +00:00
parent 2f58db6643
commit 89a41d52ae
6 changed files with 316 additions and 86 deletions

View File

@@ -48,9 +48,19 @@ class Locale
** Populate the object using raw data from SQL
*****/
public function populate($row) {
$this->name = $row['name'];
$this->display_name = $row['display_name'];
$this->flag_name = $row['flag_name'];
if (!is_array($row)) {
return;
}
if (array_key_exists('name', $row)) {
$this->name = $row['name'];
}
if (array_key_exists('display_name', $row)) {
$this->display_name = $row['display_name'];
}
if (array_key_exists('flag_name', $row)) {
$this->flag_name = $row['flag_name'];
}
}
}
@@ -95,4 +105,4 @@ class Locales
}
}
?>
?>