Use === when testing for empty value and setting defaults

This commit is contained in:
Isaac Connor 2020-03-09 14:39:22 -04:00
parent d055d40bfb
commit a0bd602339
1 changed files with 3 additions and 2 deletions

View File

@ -216,7 +216,8 @@ Logger::Debug("$k => Have default for $v: ");
} }
} }
} # end foreach default } # end foreach default
} } # end if defaults
foreach ( $new_values as $field => $value ) { foreach ( $new_values as $field => $value ) {
if ( method_exists($this, $field) ) { if ( method_exists($this, $field) ) {
@ -299,7 +300,7 @@ Logger::Debug("$k => Have default for $v: ");
# Set defaults. Note that we only replace "" with null, not other values # Set defaults. Note that we only replace "" with null, not other values
# because for example if we want to clear TimestampFormat, we clear it, but the default is a string value # because for example if we want to clear TimestampFormat, we clear it, but the default is a string value
foreach ( $this->defaults as $field => $default ) { foreach ( $this->defaults as $field => $default ) {
if ( (!property_exists($this, $field)) or ($this->{$field} == '') ) { if ( (!property_exists($this, $field)) or ($this->{$field} === '') ) {
if ( is_array($default) ) { if ( is_array($default) ) {
$this->{$field} = $default['default']; $this->{$field} = $default['default'];
} else if ( $default == null ) { } else if ( $default == null ) {