Skip to content

Commit 73ecbf1

Browse files
committed
Remove the __call check.
1 parent 2894aa0 commit 73ecbf1

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/Symfony/Component/Form/Tests/Fixtures/Magician.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ public function __call($method, $arguments) {
2929
if (preg_match('/^(get|is|has)([A-Z].*)$/', $method, $matches)) {
3030
return $this->{lcfirst($matches[2])};
3131
}
32-
return null;
3332
}
3433
}

src/Symfony/Component/Form/Util/PropertyPath.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,13 @@ private function &readProperty(&$objectOrArray, $property, $isIndex)
420420
$isser = 'is'.$camelProp;
421421
$hasser = 'has'.$camelProp;
422422

423-
if ($reflClass->hasMethod($getter)) {
423+
if (is_callable(array($objectOrArray, $getter))) {
424+
$result[self::VALUE] = $objectOrArray->$getter();
425+
} elseif (is_callable(array($objectOrArray, $isser))) {
426+
$result[self::VALUE] = $objectOrArray->$isser();
427+
} elseif (is_callable(array($objectOrArray, $hasser))) {
428+
$result[self::VALUE] = $objectOrArray->$hasser();
429+
} elseif ($reflClass->hasMethod($getter)) {
424430
if (!$reflClass->getMethod($getter)->isPublic()) {
425431
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $getter, $reflClass->name));
426432
}
@@ -438,15 +444,6 @@ private function &readProperty(&$objectOrArray, $property, $isIndex)
438444
}
439445

440446
$result[self::VALUE] = $objectOrArray->$hasser();
441-
} elseif ($reflClass->hasMethod('__call') &&
442-
is_callable(array($objectOrArray, $getter))) {
443-
$result[self::VALUE] = $objectOrArray->$getter();
444-
} elseif ($reflClass->hasMethod('__call') &&
445-
is_callable(array($objectOrArray, $isser))) {
446-
$result[self::VALUE] = $objectOrArray->$isser();
447-
} elseif ($reflClass->hasMethod('__call') &&
448-
is_callable(array($objectOrArray, $hasser))) {
449-
$result[self::VALUE] = $objectOrArray->$hasser();
450447
} elseif ($reflClass->hasMethod('__get')) {
451448
// needed to support magic method __get
452449
$result[self::VALUE] = $objectOrArray->$property;

0 commit comments

Comments
 (0)