diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index 686afaf3c..87962bc73 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -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) diff --git a/library/Director/Import/SyncUtils.php b/library/Director/Import/SyncUtils.php index 6b317c0d1..5528b2de0 100644 --- a/library/Director/Import/SyncUtils.php +++ b/library/Director/Import/SyncUtils.php @@ -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( @@ -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