From 8b3949b7d924a3ba89a92e7883fe83cd59d32666 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 27 Sep 2017 10:13:26 +0300 Subject: [PATCH] Fixed nested object access by Object::getNestedProperty() --- .../Grav/Framework/Object/Access/NestedPropertyTrait.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php index 62f63fd426..9216bb025f 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -36,7 +36,8 @@ public function hasNestedProperty($property, $separator = null) */ public function getNestedProperty($property, $default = null, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$this->hasProperty($offset)) { @@ -78,7 +79,8 @@ public function getNestedProperty($property, $default = null, $separator = null) */ public function setNestedProperty($property, $value, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$path) { @@ -119,7 +121,8 @@ public function setNestedProperty($property, $value, $separator = null) */ public function unsetNestedProperty($property, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$path) {