Permalink
Browse files

[PropertyAccess] Fixed inverted logic

  • Loading branch information...
webmozart committed May 21, 2014
1 parent 3e81333 commit f42e588de6df54d1f11a6f7e06d00c55a9e95df8
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/Symfony/Component/PropertyAccess/PropertyAccessor.php
@@ -42,7 +42,7 @@ class PropertyAccessor implements PropertyAccessorInterface
public function __construct($magicCall = false, $throwExceptionOnInvalidIndex = false)
{
$this->magicCall = $magicCall;
$this->ignoreInvalidIndices = $throwExceptionOnInvalidIndex;
$this->ignoreInvalidIndices = !$throwExceptionOnInvalidIndex;
}
/**
@@ -116,7 +116,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
*
* @throws UnexpectedTypeException If a value within the path is neither object nor array.
*/
private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $propertyPath, $lastIndex, $ignoreInvalidIndices = false)
private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $propertyPath, $lastIndex, $ignoreInvalidIndices = true)
{
$propertyValues = array();
@@ -131,7 +131,7 @@ private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $pr
// Create missing nested arrays on demand
if ($isIndex && $isArrayAccess && !isset($objectOrArray[$property])) {
if ($ignoreInvalidIndices) {
if (!$ignoreInvalidIndices) {
if (!is_array($objectOrArray)) {
if (!$objectOrArray instanceof \Traversable) {
throw new NoSuchIndexException(sprintf(

0 comments on commit f42e588

Please sign in to comment.