Skip to content

Commit

Permalink
Fixed nested object access by Object::getNestedProperty()
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Sep 27, 2017
1 parent a535e85 commit 8b3949b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8b3949b

Please sign in to comment.