Compare both value and type

This commit is contained in:
FusionPBX
2025-08-18 12:07:52 -06:00
committed by GitHub
parent ac09adf5d8
commit bc5275fdcd
+9 -9
View File
@@ -2465,24 +2465,24 @@
if (is_array($array_value)) { continue; } if (is_array($array_value)) { continue; }
//normalize the boolean data //normalize the boolean data
if ($array_value == 'true' || $array_value == 'false') { if ($array_value === 'true' || $array_value === 'false') {
if ($parent_results[$i][$array_key] == 0) { if ($parent_results[$i][$array_key] === 0) {
$parent_results[$i][$array_key] = 'false'; $parent_results[$i][$array_key] = 'false';
} }
if ($parent_results[$i][$array_key] == 1) { if ($parent_results[$i][$array_key] === 1) {
$parent_results[$i][$array_key] = 'true'; $parent_results[$i][$array_key] = 'true';
} }
} }
//verify if the data in the database has been modified //verify if the data in the database has been modified
if ($parent_results[$i][$array_key] != $array_value) { if ($parent_results[$i][$array_key] !== $array_value) {
//echo "no match\n"; //echo "no match\n";
//echo "$parent_name.$array_key ".($parent_results[0][$array_key])." != ".$array_value."\n\n"; //echo "$parent_name.$array_key ".($parent_results[0][$array_key])." != ".$array_value."\n\n";
$data_modified = true; $data_modified = true;
break; break;
} }
//inrement the id //increment the id
$i; $i;
} }
} }
@@ -2726,17 +2726,17 @@
$k = self::sanitize($k); $k = self::sanitize($k);
//normalize the boolean data //normalize the boolean data
if ($v == 'true' || $v == 'false') { if ($v === 'true' || $v === 'false') {
if ($parent_results[$k] == 0) { if ($parent_results[$k] === 0) {
$parent_results[$k] = 'false'; $parent_results[$k] = 'false';
} }
if ($child_results[$k] == 1) { if ($child_results[$k] === 1) {
$child_results[$k] = 'true'; $child_results[$k] = 'true';
} }
} }
//verify if the data in the database has been modified //verify if the data in the database has been modified
if ($child_results[$k] != $v) { if ($child_results[$k] !== $v) {
//echo "no match\n"; //echo "no match\n";
//echo "$child_name.$k ".($child_results[$k])." != ".$v."\n\n"; //echo "$child_name.$k ".($child_results[$k])." != ".$v."\n\n";
$data_modified = true; $data_modified = true;