Skip to content

Commit

Permalink
TASK: only support Closures for callbacks in DefaultFieldResolver
Browse files Browse the repository at this point in the history
When resolving an object through the "magic" ObjectAccess returning a property value that is callable, the resolver previously called this function. This was a risk when working with user input, or even lead to misbehaviour. E.g. user Max resolved and then called as max() function.
  • Loading branch information
simstern committed Oct 18, 2021
1 parent 24f8479 commit 7999cdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Classes/Service/DefaultFieldResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function resolve($source, array $args, $context, ResolveInfo $info
$resolvedProperty = ObjectAccess::getProperty($source, $fieldName);
}

if (is_callable($resolvedProperty)) {
if ($resolvedProperty instanceof \Closure) {
return $resolvedProperty($source, $args, $context, $info);
}

Expand Down

0 comments on commit 7999cdb

Please sign in to comment.