From a6dc7ba0fc769f5af8aceebaa4669d429df557fe Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 3 Feb 2022 17:30:38 -0500 Subject: [PATCH] Add debugging, but commented out --- web/includes/Object.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/includes/Object.php b/web/includes/Object.php index ff5d40baa..5023587fd 100644 --- a/web/includes/Object.php +++ b/web/includes/Object.php @@ -237,10 +237,13 @@ class ZM_Object { $changes = array(); if ($defaults) { + // FIXME: This code basically means that the new_values must be a full object, not a subset + // Perhaps if it only concerned itself with the keys of new_values foreach ($defaults as $field => $type) { if (isset($new_values[$field])) continue; if (isset($this->defaults[$field])) { + //Debug("Setting default for $field"); if (is_array($this->defaults[$field])) { $new_values[$field] = $this->defaults[$field]['default']; } else { @@ -255,9 +258,11 @@ class ZM_Object { if (array_key_exists($field, $this->defaults) && is_array($this->defaults[$field]) && isset($this->defaults[$field]['filter_regexp'])) { if (is_array($this->defaults[$field]['filter_regexp'])) { foreach ($this->defaults[$field]['filter_regexp'] as $regexp) { + //Debug("regexping array $field $value to " . preg_replace($regexp, '', trim($value))); $value = preg_replace($regexp, '', trim($value)); } } else { + //Debug("regexping $field $value to " . preg_replace($this->defaults[$field]['filter_regexp'], '', trim($value))); $value = preg_replace($this->defaults[$field]['filter_regexp'], '', trim($value)); } } @@ -265,10 +270,12 @@ class ZM_Object { $old_value = $this->$field(); if (is_array($old_value)) { $diff = array_recursive_diff($old_value, $value); + //Debug("$field array old: " .print_r($old_value, true) . " new: " . print_r($value, true). ' diff: '. print_r($diff, true)); if ( count($diff) ) { $changes[$field] = $value; } } else if ( $this->$field() != $value ) { + //Debug("$field != $value"); $changes[$field] = $value; } } else if (property_exists($this, $field)) {