Cms: Undefined variable: accessToken

Created on 27 Aug 2019  路  4Comments  路  Source: craftcms/cms

Description

When opening the default GraphQL schema in the control panel, a php notice is raised: compact(): Undefined variable: accessToken in line 218 of GraphqlController

The variable $accessToken is only defined in the else part in the condition above this line, so whenever the condition matches, $accessToken is not defined.

Steps to reproduce

  1. Visit admin/graphql/schemas after upgrading Craft 3.2 to 3.3
  2. Click on the default schema listed there

Additional info

  • Craft version: Craft Pro 3.3.0
  • PHP version: 7.3.8
  • Database driver & version: MySQL 5.7.27

Most helpful comment

Just fixed this for the next release.

To get the fix early, change your craftcms/cms requirement in composer.json to:

"require": {
  "craftcms/cms": "dev-develop#33a625fcc102775fce7e6e6121cee2c04ee1c125 as 3.3.0",
  "...": "..."
}

Then run composer update.

All 4 comments

Interesting, I wasn鈥檛 seeing this on PHP 7.2 but 7.3 may be more strict. Will get it fixed.

Was just too excited to try out the recently announcement of GraphQL api and the headlessMode and also got this this error.

My current settings are:

PHP version | 7.3.6
Database driver & version | MySQL 5.5.5
Craft edition & version | Craft Pro 3.3.0

Just fixed this for the next release.

To get the fix early, change your craftcms/cms requirement in composer.json to:

"require": {
  "craftcms/cms": "dev-develop#33a625fcc102775fce7e6e6121cee2c04ee1c125 as 3.3.0",
  "...": "..."
}

Then run composer update.

That last commit introduced another bug. If you experienced the original issue and/or updated to 33a625fcc102775fce7e6e6121cee2c04ee1c125, please update to Craft 3.3.0.1.

Was this page helpful?
0 / 5 - 0 ratings