mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 04:46:04 +03:00
Do not mess with original value in executor. Copy it instead.
This commit is contained in:
parent
913caf33ec
commit
83e33659cb
@ -193,7 +193,6 @@ class Executor
|
||||
* @param ExecutionContext $exeContext
|
||||
* @param ObjectType $parentType
|
||||
* @param $sourceList
|
||||
* @param $sourceIsList
|
||||
* @param $fields
|
||||
* @return array
|
||||
* @throws Error
|
||||
@ -598,8 +597,11 @@ class Executor
|
||||
$resultTypeMap = [];
|
||||
$typeNameMap = [];
|
||||
$cursors = [];
|
||||
$copied = [];
|
||||
|
||||
foreach ($result as $index => $item) {
|
||||
$copied[$index] = $item;
|
||||
|
||||
if (null !== $item) {
|
||||
$objectType = $itemType->getObjectType($item, $info);
|
||||
|
||||
@ -607,7 +609,7 @@ class Executor
|
||||
$exeContext->addError(new Error(
|
||||
"Runtime Object type \"$objectType\" is not a possible type for \"$itemType\"."
|
||||
));
|
||||
$result[$index] = null;
|
||||
$copied[$index] = null;
|
||||
} else {
|
||||
$listPerObjectType[$objectType->name][] = $item;
|
||||
$resultTypeMap[$index] = $objectType->name;
|
||||
@ -626,7 +628,7 @@ class Executor
|
||||
|
||||
// Restore order:
|
||||
$completed = [];
|
||||
foreach ($result as $index => $item) {
|
||||
foreach ($copied as $index => $item) {
|
||||
if (null === $item) {
|
||||
// Complete nulls separately
|
||||
$completed[] = self::completeValueCatchingError($exeContext, $itemType, $fieldASTs, $info, $item);
|
||||
|
Loading…
Reference in New Issue
Block a user