diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 17321f5fd..93b2711e5 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -24,11 +24,12 @@ jobs: - uses: actions/checkout@v2 - name: Install PHP - uses: shivammathur/setup-php@2.9.0 + uses: shivammathur/setup-php@2.18.1 with: php-version: ${{ matrix.php }} coverage: none extensions: json, mbstring + - name: Get Composer Cache Directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1fd7f5d..764e795ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ #### Unreleased +#### 14.11.6 + +Fixed: +- Fix validation of modified sparse ASTs + #### 14.11.5 Fixed: diff --git a/src/Validator/ValidationContext.php b/src/Validator/ValidationContext.php index 549053eb5..0b25ff9a4 100644 --- a/src/Validator/ValidationContext.php +++ b/src/Validator/ValidationContext.php @@ -180,16 +180,15 @@ public function getFragmentSpreads(HasSelectionSet $node) : array while (count($setsToVisit) > 0) { $set = array_pop($setsToVisit); - for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) { - $selection = $set->selections[$i]; + foreach ($set->selections as $selection) { if ($selection instanceof FragmentSpreadNode) { $spreads[] = $selection; - } elseif ($selection instanceof FieldNode || $selection instanceof InlineFragmentNode) { - if ($selection->selectionSet) { - $setsToVisit[] = $selection->selectionSet; - } } else { - throw InvariantViolation::shouldNotHappen(); + assert($selection instanceof FieldNode || $selection instanceof InlineFragmentNode); + $selectionSet = $selection->selectionSet; + if ($selectionSet !== null) { + $setsToVisit[] = $selectionSet; + } } } }