Skip to content

Commit

Permalink
SyncUtils: give NULL on nested intermediate NULL
Browse files Browse the repository at this point in the history
fixes #2474
fixes #2584
  • Loading branch information
Thomas-Gelf committed Nov 3, 2022
1 parent 3d1ad3d commit 9320a83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/82-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ v1.10.2 (unreleased)
* FIX: triggering Sync manually produced an error on PostgreSQL (#2636)
* FIX: purge stopped working for objects with uppercase characters (#2627)
* FIX: Notification Apply rule is now possible (wasn't since v1.8) (#2142, #2634)
* FIX: nested property access with intermediate NULL values now gives NULL (#2474, #2584)

### Configuration Baskets
* FEATURE: more details shown in error messages related to invalid characters (#2646)
Expand Down
7 changes: 5 additions & 2 deletions library/Director/Import/SyncUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public static function getSpecificValue($row, $var)
if (! property_exists($row, $main)) {
return null;
}
if ($row->$main === null) {
return null;
}

if (! is_object($row->$main)) {
throw new InvalidArgumentException(sprintf(
Expand All @@ -107,12 +110,12 @@ public static function getSpecificValue($row, $var)
/**
* Fill variables in the given string pattern
*
* This replaces all occurances of ${var_name} with the corresponding
* This replaces all occurrences of ${var_name} with the corresponding
* property $row->var_name of the given row object. Missing variables are
* replaced by an empty string. This works also fine in case there are
* multiple variables to be found in your string.
*
* @param string $string String with opional variables/placeholders
* @param string $string String with optional variables/placeholders
* @param object $row stdClass object providing property values
*
* @return string
Expand Down

0 comments on commit 9320a83

Please sign in to comment.